Changeset - f9593805e109
[Not reviewed]
default
0 4 0
Drew Perttula - 7 years ago 2018-05-14 02:38:00
drewp@bigasterisk.com
no more 'listeners' in polymer2. use 'ready' event more.
Ignore-this: a32c3be6f48e9b26e3e03b89e67c60fc
4 files changed with 21 insertions and 21 deletions:
0 comments (0 inline, 0 general)
light9/web/coffee_element.coffee
Show inline comments
 
# Polymer seems to need static getters for 'observers' and
 
# 'listeners', not just static attributes, though I don't know how it
 
# 'properties', not just static attributes, though I don't know how it
 
# can even tell the difference.
 
#
 
# This workaround is to use names like '@getter_properties' in the
 
@@ -7,7 +7,7 @@
 
# 
 
# Also see http://coffeescript.org/#unsupported-get-set
 
window.coffeeElementSetup = (cls) ->
 
  for attr in ['properties', 'observers', 'listeners']
 
  for attr in ['properties', 'observers']
 
    val = cls['getter_' + attr]
 
    if val?
 
      do (val) ->
light9/web/timeline/adjusters.coffee
Show inline comments
 
@@ -9,10 +9,9 @@ coffeeElementSetup(class AdjustersCanvas
 
  @getter_observers: [
 
    'updateAllCoords(adjs)'
 
  ]
 
  @getter_listeners:
 
    'iron-resize': 'resizeUpdate'
 
  connectedCallback: ->
 
    super.connectedCallback()
 
  ready: ->
 
    super.ready()
 
    @addEventListener('iron-resize', @resizeUpdate.bind(@))
 
    @adjs = {}
 
    @ctx = @$.canvas.getContext('2d')
 

	
light9/web/timeline/cursor_canvas.coffee
Show inline comments
 
@@ -2,21 +2,22 @@ coffeeElementSetup(class CursorCanvas ex
 
  @is: 'light9-cursor-canvas'
 
  @getter_properties:
 
    viewState: { type: Object, notify: true, observer: "onViewState" }
 
  @getter_listeners: 'iron-resize': 'update'
 
  connectedCallback: ->
 
    super.connectedCallback()
 
  ready: ->
 
    super.ready()
 
    @mouseX = 0
 
    @mouseY = 0
 
    @cursorPath = null
 
    @ctx = @$.canvas.getContext('2d')
 
    @onResize()
 
    @addEventListener('iron-resize', @onResize.bind(@))
 

	
 
  onViewState: ->
 
    ko.computed(@redrawCursor.bind(@))
 

	
 
  update: (ev) ->
 
    @$.canvas.width = ev.target.offsetWidth
 
    @$.canvas.height = ev.target.offsetHeight
 
    @redraw()
 
  onResize: (ev) ->
 
    @$.canvas.width = @offsetWidth
 
    @$.canvas.height = @offsetHeight
 
    @redrawCursor()
 

	
 
  redrawCursor: ->
 
    vs = @viewState
 
@@ -32,7 +33,7 @@ coffeeElementSetup(class CursorCanvas ex
 
      mid2: $V([xZoomedOut - 1, vs.audioY() + vs.audioH()])
 
      mid3: $V([xZoomedOut + 1, vs.audioY() + vs.audioH()])
 
      bot0: $V([xZoomedIn, vs.zoomedTimeY() + vs.zoomedTimeH()])
 
      bot1: $V([xZoomedIn, @offsetParent.offsetHeight])
 
      bot1: $V([xZoomedIn, @offsetHeight])
 
    }
 
    @redraw()
 

	
light9/web/timeline/timeline.coffee
Show inline comments
 
@@ -205,8 +205,8 @@ coffeeElementSetup(class TimelineEditor 
 
    '_onSongDuration(songDuration, viewState)',
 
    '_onSongTime(songTime, viewState)',
 
  ]
 
  connectedCallback: ->
 
    super.connectedCallback()
 
  ready: ->
 
    super.ready()
 
    
 
    ko.options.deferUpdates = true;
 
    
 
@@ -401,8 +401,8 @@ coffeeElementSetup(class TimeZoomed exte
 
         backgroundColor: 0xff6060,
 
    })
 
     
 
  connectedCallback: ->
 
    super.connectedCallback()
 
  ready: ->
 
    super.ready()
 
     
 
    @addEventListener('iron-resize', @update.bind(@))
 
    @update()
 
@@ -528,7 +528,6 @@ class Note
 
  constructor: (@graph, @selection, @dia, @uri, @setAdjuster, @song, @zoomInX)->0
 
  @is: 'light9-timeline-note'
 
  @behaviors: [ Polymer.IronResizableBehavior ]
 
  @listeners: 'iron-resize': 'update' #move to parent elem
 
  @properties:
 
    graph: { type: Object, notify: true }
 
    selection: { type: Object, notify: true }
 
@@ -544,6 +543,7 @@ class Note
 
    ]
 
  ready: ->
 
    @adjusterIds = {} # id : true
 
    @addEventListener('iron-resize', @update)
 

	
 
  detached: ->
 
    log('detatch', @uri)
 
@@ -702,8 +702,8 @@ coffeeElementSetup(class DiagramLayer ex
 
  @getter_properties: {
 
    selection: {type: Object, notify: true}
 
  }
 
  connectedCallback: ->
 
    super.connectedCallback()
 
  ready: ->
 
    super.ready()
 
    @elemById = {}
 

	
 
 
0 comments (0 inline, 0 general)