Changeset - 748a2e8afd30
[Not reviewed]
default
0 1 0
Drew Perttula - 9 years ago 2016-06-09 05:16:32
drewp@bigasterisk.com
rdf graph adjuster, use new runHandler api
Ignore-this: 51fe3a2f2799f473658cc83ed8485ecc
1 file changed with 9 insertions and 3 deletions:
0 comments (0 inline, 0 general)
light9/web/timeline/adjustable.coffee
Show inline comments
 
@@ -93,6 +93,11 @@ class window.AdjustableFloatObject exten
 
    #   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 @@ class window.AdjustableFloatObject exten
 
    @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
0 comments (0 inline, 0 general)