Drag and drop fixes

This commit is contained in:
2015-08-04 20:01:31 +02:00
parent d4a1052761
commit fcc11a1b87
10 changed files with 31 additions and 27 deletions
@@ -14,6 +14,7 @@ App.SectionTableView = Ember.View.extend DragNDrop.Draggable,
"section-table-#{@get('content.id')}"
).property('content.id')
offsetX: (->
debugger unless @get('dpm')
(@get('dpm') || 0) * (@get('content.position_x') || 0)
).property('dpm', 'content.position_x')
offsetY: (->
@@ -28,7 +29,7 @@ App.SectionTableView = Ember.View.extend DragNDrop.Draggable,
style: Ember.computed 'offsetX', 'offsetY', 'myWidth', 'myHeight', ->
"position:absolute;width:#{@get('myWidth')}px;height:#{@get('myHeight')}px;left:#{@get('offsetX')}px;top:#{@get('offsetY')}px"
draggable: (-> if @get('controller.editmode') then 'true' else 'false' ).property('controller.editmode')
draggable: Ember.computed.alias 'context.editmode'
targetObject: Ember.computed.alias 'controller'
placeInSection: ->
@$el.css 'left', @offsetX()
@@ -37,11 +38,11 @@ App.SectionTableView = Ember.View.extend DragNDrop.Draggable,
dpm = @get('dpm')
return if !dpm or parseFloat(dpm) is 0
@content.setProperties
@get('content').setProperties
position_x: position.left / dpm
position_y: position.top / dpm
@content.save()
dpm: Ember.computed.alias 'parentView.dpm'
@get('content').save()
dpm: Ember.computed.alias 'tablesContext.dpm'
didInsertElement: ->
@$el = @$()
@$('.table-actions').hide()