我正在尝试修改paperjs中对象的边界矩形。下面是我的代码:
project.currentStyle = {
fillColor: 'green',
strokeColor: 'black'
};
var circle = new Path.Circle(new Point(150, 150), 50);
var bounds = circle.bounds;
bounds.insert(2, new Point(bounds.center.x, bounds.top));
bounds.insert(2, new Point(bounds.center.x, bounds.top-25));
bounds.insert(2, new Point(bounds.center.x, bounds.top));我得到一个错误,bounds.insert不是一个函数。如果这是不可能的,我如何添加线段到边界矩形?
发布于 2019-04-12 23:01:47
在创建矩形Path的Path.Rectangle()方法和对应于抽象几何形状的Rectangle之间存在差异:
Rectangle指定一个区域,该区域由其左上点(x,y)、宽度和高度包围。它不应该与矩形路径混淆,它不是一个项目。
您可以轻松地从您的圆边界创建一个Path:
let rectanglePath = new Path.Rectangle(circle.bounds);
rectanglePath.strokeColor = 'red';https://stackoverflow.com/questions/55654175
复制相似问题