|
|
@ -20,13 +20,15 @@ class app.views.Resizer extends app.View
|
|
|
|
MIN = 250
|
|
|
|
MIN = 250
|
|
|
|
MAX = 600
|
|
|
|
MAX = 600
|
|
|
|
|
|
|
|
|
|
|
|
resize: (newSize) ->
|
|
|
|
resize: (value, save) ->
|
|
|
|
return unless newSize > 0
|
|
|
|
return unless value > 0
|
|
|
|
newSize = Math.min(Math.max(Math.round(newSize), MIN), MAX)
|
|
|
|
value = Math.min(Math.max(Math.round(value), MIN), MAX)
|
|
|
|
app.settings.setSize(newSize)
|
|
|
|
newSize = "#{value}px"
|
|
|
|
newSize = "#{newSize}px"
|
|
|
|
|
|
|
|
@style.innerHTML = @style.innerHTML.replace(new RegExp(@size, 'g'), newSize)
|
|
|
|
@style.innerHTML = @style.innerHTML.replace(new RegExp(@size, 'g'), newSize)
|
|
|
|
@size = newSize
|
|
|
|
@size = newSize
|
|
|
|
|
|
|
|
if save
|
|
|
|
|
|
|
|
app.settings.setSize(value)
|
|
|
|
|
|
|
|
app.appCache?.updateInBackground()
|
|
|
|
return
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
onDragStart: (event) =>
|
|
|
|
onDragStart: (event) =>
|
|
|
@ -38,9 +40,9 @@ class app.views.Resizer extends app.View
|
|
|
|
onDrag: (event) =>
|
|
|
|
onDrag: (event) =>
|
|
|
|
return if @lastDrag and @lastDrag > Date.now() - 50
|
|
|
|
return if @lastDrag and @lastDrag > Date.now() - 50
|
|
|
|
@lastDrag = Date.now()
|
|
|
|
@lastDrag = Date.now()
|
|
|
|
@resize event.clientX
|
|
|
|
@resize(event.clientX, false)
|
|
|
|
return
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
onDragEnd: (event) =>
|
|
|
|
onDragEnd: (event) =>
|
|
|
|
@resize event.screenX - window.screenX
|
|
|
|
@resize(event.screenX - window.screenX, true)
|
|
|
|
return
|
|
|
|
return
|
|
|
|