Skip to content

Instantly share code, notes, and snippets.

@drcmda
Created September 16, 2016 08:30
Show Gist options
  • Save drcmda/9d308cb293781f322c77ad03e47e741f to your computer and use it in GitHub Desktop.
Save drcmda/9d308cb293781f322c77ad03e47e741f to your computer and use it in GitHub Desktop.
multiple interaction handles, keyed
application
canvas
scene
class VersatileObject(obj1) -> eventhandler
obj2 -> eventhandler
obj3 -> eventhandler
plugins
UI elements [selection] -> notify
pluginsystem->events->override
pluginsystem
enabled
canvas.filter[only i can do it]
exposes
hover
unhover
click
THREE.Object3 extends EventEmitter
.__Event.Hover
.on(Event.Hover)
.createInteraction()
.WhenImInTheView()->add me to view.interaction
obj
.__interactions[]
.createInteraction("recursive") = stored in obj.__interaction[] obj.on(__interaction.forEach.)
.on(Hover)
.enabled
.createInteraction("from the plugin system", "rules", filter)
.on(Hover)
.onDeactivate -> remove
.createInteraction("scene")
.onDeactivate -> remove
object.createInteraction({ filter, key: "test" })
object.createInteraction("plugin", plugin)
object.createInteraction("stepan", you)
interaction
object.emit("Hover")
object.emit("plugin:Hover")
object.emit("stepan:Hover")
listeners
object.on("Hover") <- application is happy
object.on("plugin:Hover") <- pluginsystem is happy
object.on("stepan:Hover") <- stepan is also happy
object.createInteraction()
.interactions = [{ ... filter }]
object.interactions.forEach(item => item.enabled = false)
plugin-system
1. when enabled: [browse through view.interaction.object -> disabled]
2. when disabled: [...].enabled
3. create its own iteraction for scene
---------------------------------------------------------------------
4. now plugins
onEnabled
scene.createInteraction("Sketch", rules)
.on.on.on.on
singleObj.createInteraction("Sketch", rules)
.on.on.on.on
obj.createIteraction("application").disabled
obj.createIteraction("plugin")
interaction
obj.on(hover)
obj.on(...)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment