admin管理员组文章数量:1022688
I am using jointJS for my academic project, I have such a question, How an element accesses position, inPorts, outPorts? For example, we create an element like this,
var m1 = new joint.shapes.devs.Model({
position: { x: 50, y: 50 },
size: { width: 90, height: 90 },
inPorts: ['in1','in2'],
outPorts: ['out'],
attrs: {
'.label': { text: 'Model', 'ref-x': .4, 'ref-y': .2 },
rect: { fill: '#2ECC71' },
'.inPorts circle': { fill: '#16A085' },
'.outPorts circle': { fill: '#E74C3C' }
}
});
graph.addCell(m1);
I want to get position
and inPorts
from m1
, I have tried m1( 'position' )
and m1.position()
, but it didn't work.
Can someone solve this problem? Thank you in advance.
I am using jointJS for my academic project, I have such a question, How an element accesses position, inPorts, outPorts? For example, we create an element like this,
var m1 = new joint.shapes.devs.Model({
position: { x: 50, y: 50 },
size: { width: 90, height: 90 },
inPorts: ['in1','in2'],
outPorts: ['out'],
attrs: {
'.label': { text: 'Model', 'ref-x': .4, 'ref-y': .2 },
rect: { fill: '#2ECC71' },
'.inPorts circle': { fill: '#16A085' },
'.outPorts circle': { fill: '#E74C3C' }
}
});
graph.addCell(m1);
I want to get position
and inPorts
from m1
, I have tried m1( 'position' )
and m1.position()
, but it didn't work.
Can someone solve this problem? Thank you in advance.
Share Improve this question asked Feb 23, 2015 at 9:29 YabingYabing 431 silver badge5 bronze badges1 Answer
Reset to default 7You can use m1.get('position')
and m1.get('inPorts')
. You could also use m1.prop('position')
and m1.prop('inPorts')
. The difference is that get(property)
is only for accessing flat properties while prop(path)
is able to get nested properties as well (e.g. m1.prop('attrs/rect/fill')
.
I am using jointJS for my academic project, I have such a question, How an element accesses position, inPorts, outPorts? For example, we create an element like this,
var m1 = new joint.shapes.devs.Model({
position: { x: 50, y: 50 },
size: { width: 90, height: 90 },
inPorts: ['in1','in2'],
outPorts: ['out'],
attrs: {
'.label': { text: 'Model', 'ref-x': .4, 'ref-y': .2 },
rect: { fill: '#2ECC71' },
'.inPorts circle': { fill: '#16A085' },
'.outPorts circle': { fill: '#E74C3C' }
}
});
graph.addCell(m1);
I want to get position
and inPorts
from m1
, I have tried m1( 'position' )
and m1.position()
, but it didn't work.
Can someone solve this problem? Thank you in advance.
I am using jointJS for my academic project, I have such a question, How an element accesses position, inPorts, outPorts? For example, we create an element like this,
var m1 = new joint.shapes.devs.Model({
position: { x: 50, y: 50 },
size: { width: 90, height: 90 },
inPorts: ['in1','in2'],
outPorts: ['out'],
attrs: {
'.label': { text: 'Model', 'ref-x': .4, 'ref-y': .2 },
rect: { fill: '#2ECC71' },
'.inPorts circle': { fill: '#16A085' },
'.outPorts circle': { fill: '#E74C3C' }
}
});
graph.addCell(m1);
I want to get position
and inPorts
from m1
, I have tried m1( 'position' )
and m1.position()
, but it didn't work.
Can someone solve this problem? Thank you in advance.
Share Improve this question asked Feb 23, 2015 at 9:29 YabingYabing 431 silver badge5 bronze badges1 Answer
Reset to default 7You can use m1.get('position')
and m1.get('inPorts')
. You could also use m1.prop('position')
and m1.prop('inPorts')
. The difference is that get(property)
is only for accessing flat properties while prop(path)
is able to get nested properties as well (e.g. m1.prop('attrs/rect/fill')
.
本文标签:
版权声明:本文标题:javascript - In JointJS, how an element accesses position, inPorts, outPorts? - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745487614a2152813.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论