Skip to content

Instantly share code, notes, and snippets.

@drcmda
Created March 14, 2016 11:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drcmda/a45e2fca8a17b0cc36a3 to your computer and use it in GitHub Desktop.
Save drcmda/a45e2fca8a17b0cc36a3 to your computer and use it in GitHub Desktop.
interaction draft
let { firstModel } = await canvas.parser.stream('/assembly.txt'));
firstModel.interaction.recursive = true;
firstModel.interaction.listen("hover", object => console.log(`%{object.name}: hover`);
let secondListener = firstModel.interaction.listen("hover", object => console.log(`2nd callback %{object.name}: hover`);
firstModel.interaction.listen("unhover", object => console.log(`%{object.name}: unhover`);
firstModel.interaction.listen("drag", (object, type) => {
switch (type) {
case 'start': console.log(`%{object.name}: drag started`; break;
case 'drag': console.log(`%{object.name}: dragging`; break;
case 'end':
firstModel.interaction.remove(secondListener);
break;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment