javascript - Looking for details about event triggering on KineticJS with groups and its children -


i planning create elements in application can used group. example create circle triangle , square , group them. drag , drop group , etc. want able edit group elementts individually.

for can call setdraggable(false) group , setdraggable(true) children , edit them individually. when wish treat them group can call setdraggable(true) group shape , setdraggable(false) children of group.

i think part works well. problem event handling. tried search didn't found talking behavior of events on grouped objects. far noticed events group children overrides event call group. example if element e1 group has "onclick" event , group object has "onclick" event when click on e1 event triggered event e1 object.

so.... tl;dr: can explain how event triggering works on kineticjs groups, children , nested groups?

edit:

  • http*//jsfiddle*net/kaze_senshi/gkfrk/ little project made test kineticjs's group behavior. in start there 1 group rects , 1 group circles, can join groups , move each element square group individually clicking in buttons @ left of scree. pretty simple page ugly code test purposes.

  • https://github.com/wfaria/sketchproject/blob/development/tests/interfaceresourcetest.html in end want manipulate group object project kineticjs, because of doing these questions, think can understand how works looking unitary test page. can find more details in src/model/interfaceresource.js

if have group , children , want turn events on , off can this:

 group.setlistening(false); // group not listen events   groupchild.setlistening(true); // child listening defined events on child. 

and point in right direction, shape events fired priority on group events, have noticed, if both have onclick have add logic don't interfere 1 another. simple way set flags turn events on off based on conditions.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -