首页 > 解决方案 > Paperjs 参考不包括所有选项

问题描述

您能否建议我在哪里可以找到有关 Group({insert:true}) 选项的解释,因为我在参考中找不到它?这个选项是如何工作的,如果有人做了那个例子,他应该能够在某个地方读到它。谢谢。

标签: paperjs

解决方案


此项目构造函数选项是一个内部 API,实际上没有公共用例,这就是您在文档中没有找到它的原因。
它主要用于内部操作和测试目的。
默认情况true下,如果将其设置为false,则创建的项目将不会插入到场景图中,这意味着您不会在屏幕上看到它。

查看此草图以进行演示。

// This item will be inserted as a child of the active layer.
const itemInserted = new Path.Circle({
    center: view.center - 50,
    radius: 50,
    fillColor: 'orange'
});

// This item will not be inserted in the scene graph.
const itemNotInserted = new Path.Circle({
    center: view.center + 50,
    radius: 50,
    fillColor: 'blue',
    insert: false
});

推荐阅读