最近,我需要制作一个JointJs图的交互模式。众所周知,创建纸张对象的过程是这样的:
paper = new joint.dia.Paper({
el: $(#myDiagram),
width: this.props.width,
height: this.props.height,
model: this.state.graph,
gridSize: 1,
interactive: false
});您可以使用所需的选项创建一张新的纸张。在这种情况下,交互( "interactive“标志)被设置为false。不幸的是,在一个纸张对象上没有get,attrs,set方法。我想创建一个更改交互式标志的按钮。它的位置在纸张内部的options对象中。手动访问会更改该值,但这根本不会反映论文。每次更改交互时重新初始化它是唯一的解决方案吗?事先谢谢你。
发布于 2017-03-25 02:16:14
这已经改变了,而且变得更好了。我使用的是jointjs 1.0.3,这对我来说是有效的:
edit() {
const self = this
this.graph.getCells().forEach(function (cell) {
const c = cell.findView(self.paper)
c.setInteractivity(true)
})
}https://stackoverflow.com/questions/32073497
复制相似问题