zzzcl
zzzcl

Reputation: 11

Only element boundaries can be connected in jointjs?

I just want to make my element boundary "magnet=true", and the internal is not a crosshair cursor but a move cursor, how to achieve?

Upvotes: 0

Views: 138

Answers (1)

zzzcl
zzzcl

Reputation: 11

I changed my element definition as follows:

markup :
...
<rect class="body"/>
<rect class="icon-box"/>
<path class="ele-icon"/>
...

attrs:

...
'.body':{magnet:true,width:50,height:50}
'.icon-box':{
    width:48,
    height:48, 
    'x-alignment': 'middle',
    'y-alignment': 'middle',
    'ref-x': .5,
    'ref-y': .5,
    ref: '.body',
    fill:'white'
}
...

I added a rect as a box of icon,so that only the outside of icon-box can connect.

I will be very grateful if you have a better way!!!

Upvotes: 0

Related Questions