\r
\r
# ground-picture\r
+ refresh_ground_picture = (element_trace) ->\r
+ x = parseInt($(element_trace + 'x').val()).toString() + 'px'\r
+ y = parseInt($(element_trace + 'y').val()).toString() + 'px'\r
+ $(element_trace).css('background-position', x + ' ' + y)\r
+ \r
# sync view \r
$('input').map ->\r
if editor.element_is('ground_picture', $(@))\r
- $(@).focusout ->\r
- switch $(@).attr('column')\r
- when 'x', 'y'\r
+ switch $(@).attr('column')\r
+ when 'x', 'y'\r
+ $(@).focusout ->\r
trace = editor.element_tag_id($(@))\r
- x = parseInt($(trace + 'x').val()).toString() + 'px'\r
- y = parseInt($(trace + 'y').val()).toString() + 'px'\r
- $(trace).css('background-position', x + ' ' + y)\r
+ refresh_ground_picture(trace)\r
+ $(@).spinner {\r
+ stop: ( event, ui ) ->\r
+ trace = editor.element_tag_id($(@))\r
+ refresh_ground_picture(trace)\r
+ }\r
$('select').map ->\r
if editor.element_is('ground_picture', $(@))\r
$(@).change ->\r
# ground_color\r
ColorHelper.add_helper($('.ground_color-code-wrap'), 'code')\r
\r
+ refresh_ground_color = (element_trace) ->\r
+ orientation = parseInt( $(element_trace + 'orientation').val() )\r
+ xy = $(element_trace + 'xy').val()\r
+ wh = $(element_trace + 'wh').val()\r
+ div_offset = if xy\r
+ xy\r
+ else\r
+ 0\r
+ div_size = if wh\r
+ wh\r
+ else\r
+ 100 - div_offset\r
+ div_x = if orientation == 0\r
+ 0\r
+ else\r
+ div_offset\r
+ div_y = if orientation == 0\r
+ div_offset\r
+ else\r
+ 0\r
+ div_width = if orientation == 0\r
+ 100\r
+ else\r
+ div_size\r
+ div_height = if orientation == 0\r
+ div_size\r
+ else\r
+ 100\r
+ div = $(element_trace)\r
+ div.css('left', div_x.toString() + '%')\r
+ div.css('top', div_y.toString() + '%')\r
+ div.css('width', div_width.toString() + '%')\r
+ div.css('height', div_height.toString() + '%')\r
+ \r
# sync view \r
$('input').map ->\r
if editor.element_is('ground_color', $(@))\r
- if $(@).attr('column') == 'code'\r
- $(@).hide()\r
+ switch $(@).attr('column')\r
+ when 'code'\r
+ $(@).hide()\r
+ when 'xy', 'wh'\r
+ $(@).spinner {\r
+ stop: ( event, ui ) ->\r
+ trace = editor.element_tag_id($(@))\r
+ refresh_ground_color(trace)\r
+ , min: 0\r
+ , max: 100\r
+ }\r
+ $(@).focusout ->\r
+ trace = editor.element_tag_id($(@))\r
+ refresh_ground_color(trace)\r
+ \r
+ $('select').map ->\r
+ if editor.element_is('ground_color', $(@))\r
+ switch $(@).attr('column')\r
+ when 'orientation'\r
+ $(@).change ->\r
+ trace = editor.element_tag_id($(@))\r
+ refresh_ground_color(trace)\r
\r
update_t = (ultrace) -> \r
t = 0\r