From ea6aa2b643d95e85df5e9fbf675563cac8e34722 Mon Sep 17 00:00:00 2001 From: Ben Gotow Date: Mon, 5 Oct 2015 14:40:45 -0700 Subject: [PATCH] fix(Sentry 3228): Bad math sending an incomplete bounds struct to Electron --- src/atom.coffee | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/atom.coffee b/src/atom.coffee index 91dd12623..91b6bee04 100644 --- a/src/atom.coffee +++ b/src/atom.coffee @@ -430,10 +430,12 @@ class Atom extends Model startTime = Date.now() boundsForI = (i) -> - x: Math.round(startBounds.x + (width-startBounds.width) * -0.5 * i) - y: Math.round(startBounds.y + (height-startBounds.height) * -0.5 * i) - width: Math.round(startBounds.width + (width-startBounds.width) * i) - height: Math.round(startBounds.height + (height-startBounds.height) * i) + # It's very important this function never return undefined for any of the + # keys which blows up setBounds. + x: Math.round(startBounds.x + (width-startBounds.width) * -0.5 * i) ? 0 + y: Math.round(startBounds.y + (height-startBounds.height) * -0.5 * i) ? 0 + width: Math.round(startBounds.width + (width-startBounds.width) * i) ? width + height: Math.round(startBounds.height + (height-startBounds.height) * i) ? height tick = -> t = Math.min(1, (Date.now() - startTime) / (duration))