使用论文js sketch中的代码here我只需单击即可看到绘制的点,而无需移动鼠标。您还可以看到该元素实际上已添加到所有 3 个浏览器中。但是,Chrome 和 IE 不显示该元素,我一生都无法理解为什么。
// The minimum distance the mouse has to drag
// before firing the next onMouseDrag event:
tool.minDistance = 1;
tool.maxDistance = 1;
function onMouseDown(e) {
// Create a new path and give it a stroke color:
path = new Path();
path.strokeColor = 'black';
path.strokeWidth = 2;
// Add a segment to the path where
// you clicked:
path.add(e.point);
}
function onMouseDrag(e) {
var top = e.middlePoint;
var bottom = e.middlePoint;
path.add(top);
path.insert(0, bottom);
}
function onMouseUp(e) {
var pt = e.point;
path.add(pt);
path.closed = true;
console.log(path);
}
最佳答案
收到 Jürg Lehni 的回复
It's probably a difference of the underlying rendering system, but an open path with only one segment should simply not be rendered, something that we should handle in the library internally.
A closed path should be rendered if it defines handles, as that can actually be a tiny little loop.
我必须设置特定的行为来处理点路径。就我而言,我使用了圆圈。
关于javascript - Paper js 'dot' 路径在 Firefox 中显示,但在 IE 或 Chrome 中不显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33024633/