gpt4 book ai didi

javascript - Paper js 'dot' 路径显示在 firefox 中,但不显示在 IE 或 Chrome 中

转载 作者:行者123 更新时间:2023-11-27 23:37:45 33 4
gpt4 key购买 nike

利用论文中的js草图代码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/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com