mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-09-22 08:16:09 +08:00
fix(atom): Never allow the window to be set to fractional sizes
This commit is contained in:
parent
a96760dbd3
commit
3ed1256fd1
|
@ -416,6 +416,8 @@ class Atom extends Model
|
||||||
# * `width` The {Number} of pixels.
|
# * `width` The {Number} of pixels.
|
||||||
# * `height` The {Number} of pixels.
|
# * `height` The {Number} of pixels.
|
||||||
setSize: (width, height) ->
|
setSize: (width, height) ->
|
||||||
|
width = Math.round(width)
|
||||||
|
height = Math.round(height)
|
||||||
@getCurrentWindow().setSize(width, height)
|
@getCurrentWindow().setSize(width, height)
|
||||||
|
|
||||||
# Essential: Transition and set the size of the current window.
|
# Essential: Transition and set the size of the current window.
|
||||||
|
@ -426,6 +428,8 @@ class Atom extends Model
|
||||||
setSizeAnimated: (width, height, duration=400) ->
|
setSizeAnimated: (width, height, duration=400) ->
|
||||||
cubicInOut = (t) -> if t<.5 then 4*t**3 else (t-1)*(2*t-2)**2+1
|
cubicInOut = (t) -> if t<.5 then 4*t**3 else (t-1)*(2*t-2)**2+1
|
||||||
win = @getCurrentWindow()
|
win = @getCurrentWindow()
|
||||||
|
width = Math.round(width)
|
||||||
|
height = Math.round(height)
|
||||||
startBounds = win.getBounds()
|
startBounds = win.getBounds()
|
||||||
|
|
||||||
startTime = Date.now()
|
startTime = Date.now()
|
||||||
|
@ -447,6 +451,7 @@ class Atom extends Model
|
||||||
|
|
||||||
setMinimumWidth: (minWidth) ->
|
setMinimumWidth: (minWidth) ->
|
||||||
win = @getCurrentWindow()
|
win = @getCurrentWindow()
|
||||||
|
minWidth = Math.round(minWidth)
|
||||||
minHeight = win.getMinimumSize()[1]
|
minHeight = win.getMinimumSize()[1]
|
||||||
win.setMinimumSize(minWidth, minHeight)
|
win.setMinimumSize(minWidth, minHeight)
|
||||||
|
|
||||||
|
@ -465,6 +470,8 @@ class Atom extends Model
|
||||||
# * `x` The {Number} of pixels.
|
# * `x` The {Number} of pixels.
|
||||||
# * `y` The {Number} of pixels.
|
# * `y` The {Number} of pixels.
|
||||||
setPosition: (x, y) ->
|
setPosition: (x, y) ->
|
||||||
|
x = Math.round(x)
|
||||||
|
y = Math.round(y)
|
||||||
ipc.send('call-window-method', 'setPosition', x, y)
|
ipc.send('call-window-method', 'setPosition', x, y)
|
||||||
|
|
||||||
# Extended: Get the current window
|
# Extended: Get the current window
|
||||||
|
|
Loading…
Reference in a new issue