1 class PettanrPictureSizeHelper
\r
2 confirm_confirm_confirm = () ->
\r
4 @WritingFormat = window.PettanrWritingFormat
\r
6 @refresh_picture = (e, w, h) ->
\r
15 pid = parseInt(e.attr('picture_id')).toString()
\r
17 src = '/pictures/' + sd + pid + '.' + ext
\r
21 editor = window.PettanrEditor
\r
22 $('.panel_picture_width_tool').map ->
\r
23 $(@).html('<button class="wreverse">Rev</button><button class="wdouble">x2</button><button class="whalf">/2</button>')
\r
24 $('.panel_picture_height_tool').map ->
\r
25 $(@).html('<button class="hreverse">Rev</button><button class="hdouble">x2</button><button class="hhalf">/2</button>')
\r
27 $('.wreverse').click ->
\r
29 trace = editor.element_tag_id(d)
\r
30 f = $(trace + 'width')
\r
33 f = $(trace + 'height')
\r
35 PettanrPictureSizeHelper.refresh_picture($(trace + 'img'), w, h)
\r
37 $('.wdouble').click ->
\r
39 trace = editor.element_tag_id(d)
\r
40 f = $(trace + 'width')
\r
43 $(trace + 'img').width(Math.abs(w))
\r
44 $(trace + 'img').parent().width(Math.abs(w))
\r
46 $('.whalf').click ->
\r
48 trace = editor.element_tag_id(d)
\r
49 f = $(trace + 'width')
\r
50 w = Math.floor(f.val() / 2)
\r
52 $(trace + 'img').width(Math.abs(w))
\r
53 $(trace + 'img').parent().width(Math.abs(w))
\r
56 $('.hreverse').click ->
\r
58 trace = editor.element_tag_id(d)
\r
59 f = $(trace + 'height')
\r
62 f = $(trace + 'width')
\r
64 PettanrPictureSizeHelper.refresh_picture($(trace + 'img'), w, h)
\r
66 $('.hdouble').click ->
\r
68 trace = editor.element_tag_id(d)
\r
69 f = $(trace + 'height')
\r
72 $(trace + 'img').height(Math.abs(h))
\r
73 $(trace + 'img').parent().height(Math.abs(h))
\r
75 $('.hhalf').click ->
\r
77 trace = editor.element_tag_id(d)
\r
78 f = $(trace + 'height')
\r
79 h = Math.floor(f.val() / 2)
\r
81 $(trace + 'img').height(Math.abs(h))
\r
82 $(trace + 'img').parent().height(Math.abs(h))
\r
86 @PettanrPictureSizeHelper = PettanrPictureSizeHelper
\r