element: @element,\r
spot: @spot\r
})\r
- @element.fetch({cache: false})\r
+ \r
+ clear: () ->\r
+ this\r
\r
render: () ->\r
- @attr = {style: Pettanr.to_style(@style())}\r
- this.$el.attr(@attr)\r
+ @restyle()\r
this.$el.html(@img.clear().el)\r
this\r
\r
+ restyle: () ->\r
+ attr = {style: Pettanr.to_style(@style())}\r
+ this.$el.attr(attr)\r
+ \r
+ add_element: (element) ->\r
+ null\r
+ \r
style: () ->\r
{\r
'top': Pettanr.to_s(@element.get('y')) + 'px',\r
this\r
\r
render: () ->\r
- this.$el.attr(@attr(@spot))\r
+ @restyle()\r
this\r
\r
+ restyle: () ->\r
+ this.$el.attr(@attr(@spot))\r
+ \r
attr: (spot = null, opacity = 20) ->\r
style = {}\r
if spot and spot.constructor == @element.constructor and spot.get('id') != @element.get('id')\r
\r
initialize: (options) ->\r
super(options)\r
- @listenTo(@root, 'input:width', @restyle)\r
- @listenTo(@root, 'input:height', @restyle)\r
+ @listenTo(@element, 'input:x', @restyle)\r
+ @listenTo(@element, 'input:y', @restyle)\r
+ @listenTo(@element, 'input:z', @restyle)\r
+ @listenTo(@element, 'active', @active)\r
+ @listenTo(@element, 'inactive', @inactive)\r
\r
render: () ->\r
super()\r
}\r
this\r
\r
+ active: () ->\r
+ $('.ui-resizable-handle', this.el).map ->\r
+ $(@).css('display', 'block')\r
+ \r
+ inactive: () ->\r
+ $('.ui-resizable-handle', this.el).map ->\r
+ $(@).css('display', 'none')\r
+ \r
element_class: (element) ->\r
Pettanr.Views[element.singular()].Element.Edit\r
\r
\r
initialize: (options) ->\r
super(options)\r
+ @listenTo(@element, 'input:width', @restyle)\r
+ @listenTo(@element, 'input:height', @restyle)\r
\r
render: () ->\r
super()\r
width: width, \r
height: height\r
}, {silent: true})\r
- elm.trigger('move')\r
+ elm.trigger('resize')\r
handles: 'all',\r
autoHide: true\r
}\r
+ \r
+ restyle: () ->\r
+ super()\r
+ resize_div = this.$el.parent()\r
+ width = this.$el.css('width')\r
+ height = this.$el.css('height')\r
+ resize_div.width(width)\r
+ resize_div.height(height)\r
+ \r