changeset 1385:748a2e8afd30

rdf graph adjuster, use new runHandler api Ignore-this: 51fe3a2f2799f473658cc83ed8485ecc
author Drew Perttula <drewp@bigasterisk.com>
date Thu, 09 Jun 2016 05:16:32 +0000
parents 6fd81bd4b4a7
children 29a1382de5c8
files light9/web/timeline/adjustable.coffee
diffstat 1 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/light9/web/timeline/adjustable.coffee	Thu Jun 09 05:16:29 2016 +0000
+++ b/light9/web/timeline/adjustable.coffee	Thu Jun 09 05:16:32 2016 +0000
@@ -93,6 +93,11 @@
     #   getValueForPos
 
     super(@config)
+    @config.graph.runHandler(@_syncValue.bind(@))
+
+  _syncValue: () ->
+    @_currentValue = @config.graph.floatValue(@config.subj, @config.pred)
+    @_onChange() if @_onChange
     
   _getValue: () ->
     # this is a big speedup- callers use _getValue about 4x as much as
@@ -103,9 +108,10 @@
     @config.getTargetTransform(@_getValue())
     
   subscribe: (onChange) ->
-    @config.graph.subscribe @config.subj, @config.pred, null, (patch) =>
-      @_currentValue = @config.graph.floatValue(@config.subj, @config.pred)
-      onChange()
+    # only works on one subscription at a time
+    throw new Error('multi subscribe not implemented') if @_onChange
+    @_onChange = onChange
+
     
   continueDrag: (pos) ->
     # pos is vec2 of pixels relative to the drag start