- if widget_layer.editing
- widget_layer.editing.kill_controls()
- widget_layer.editing = null
- deselect = (layer, s) ->
- return unless layer.selected[s.id]?
- s.set_state STATES.NORMAL
- delete layer.selected[s.id]
- if widget_layer.editing is s
- widget_layer.editing = null
- return
- deselect_all = (layer, except = null) ->
- for id, s of layer.selected
- deselect layer, s
- return
- _select = (layer, s) -> # don't call this directly, use select_only() or select_also()
- s.set_state STATES.SELECTED
- layer.selected[s.id] = s
- return
- select_only = (layer, s) ->
- deselect_all layer, s
- return if layer.selected[s.id]?
- _select layer, s
- return
- select_also = (layer, s) ->
- return if layer.selected[s.id]?
- if layer is widget_layer
- stop_editing()
- _select layer, s
+ for id, w of widgets
+ w.hide_controls()
+ return
+ deselect = (w) ->
+ return unless selected[w.id]?
+ w.set_state STATES.NORMAL
+ delete selected[w.id]
+ selected_count -= 1
+ w.hide_controls()
+ return
+ deselect_all = (except = null) ->
+ for id, w of selected
+ if w isnt except
+ deselect w
+ return
+ _select = (w) -> # don't call this directly, use select_only() or select_also()
+ w.set_state STATES.SELECTED
+ selected[w.id] = w
+ return
+ select_only = (w) ->
+ deselect_all w
+ return if selected[w.id]?
+ _select w
+ return
+ select_also = (w) ->
+ return if selected[w.id]?
+ stop_editing()
+ _select w