javascript - Paperjs group.pivot 未设置为新坐标
解决方案
根据您的代码示例,我猜您只需将栅格的位置设置为视图中心,默认情况下其轴心点将自动相同。
这是一个演示可能解决方案的草图。
// Create the raster.
const raster = new Raster({
source: 'http://assets.paperjs.org/images/marilyn.jpg',
// When image is loaded...
onLoad: () => {
// ...place it at center.
raster.position = view.center;
}
});
// Include raster in a group.
const group = new Group(raster);
// Mark center with a circle.
new Path.Circle({
center: view.center,
radius: 10,
fillColor: 'blue'
});
// Scale the group (the pivot point is bounds center by default).
group.scale(0.5);