From b7188bad30510298f4810f22b2009444cf5bc553 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Fri, 29 Apr 2016 07:13:56 +1200 Subject: [PATCH 1/2] Automatically upgrade toolbar position to bottom center of window --- scripts/system/libraries/toolBars.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/system/libraries/toolBars.js b/scripts/system/libraries/toolBars.js index 1f83a4ffa6..110e3d1ea9 100644 --- a/scripts/system/libraries/toolBars.js +++ b/scripts/system/libraries/toolBars.js @@ -452,7 +452,11 @@ ToolBar = function(x, y, direction, optionalPersistenceKey, optionalInitialPosit return id; } if (this.fractionKey || optionalInitialPositionFunction) { - var savedFraction = JSON.parse(Settings.getValue(this.fractionKey) || '0'); // getValue can answer empty string + var NEW_TOOLBAR_POSITION = "newToolbarPosition"; // New default position is bottom center of screen instead of right. + var isNewPosition = Settings.getValue(NEW_TOOLBAR_POSITION); + var savedFraction = isNewPosition ? JSON.parse(Settings.getValue(this.fractionKey) || "0") : 0; + Settings.setValue(NEW_TOOLBAR_POSITION, true); + var recommendedRect = Controller.getRecommendedOverlayRect(); var screenSize = { x: recommendedRect.width, y: recommendedRect.height }; if (savedFraction) { From 1cf53829d3adab9875ec28962e75ece01c60cbc7 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Fri, 29 Apr 2016 08:20:20 +1200 Subject: [PATCH 2/2] Fix upgrading for all toolbar buttons --- scripts/system/libraries/toolBars.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/system/libraries/toolBars.js b/scripts/system/libraries/toolBars.js index 110e3d1ea9..d97575d349 100644 --- a/scripts/system/libraries/toolBars.js +++ b/scripts/system/libraries/toolBars.js @@ -383,6 +383,9 @@ ToolBar = function(x, y, direction, optionalPersistenceKey, optionalInitialPosit }; if (optionalPersistenceKey) { this.fractionKey = optionalPersistenceKey + '.fraction'; + // FIXME: New default position in RC8 is bottom center of screen instead of right. Can remove this key and associated + // code once the new toolbar position is well established with users. + this.isNewPositionKey = optionalPersistenceKey + '.isNewPosition'; this.save = function () { var recommendedRect = Controller.getRecommendedOverlayRect(); var screenSize = { x: recommendedRect.width, y: recommendedRect.height }; @@ -452,10 +455,9 @@ ToolBar = function(x, y, direction, optionalPersistenceKey, optionalInitialPosit return id; } if (this.fractionKey || optionalInitialPositionFunction) { - var NEW_TOOLBAR_POSITION = "newToolbarPosition"; // New default position is bottom center of screen instead of right. - var isNewPosition = Settings.getValue(NEW_TOOLBAR_POSITION); + var isNewPosition = Settings.getValue(this.isNewPositionKey); var savedFraction = isNewPosition ? JSON.parse(Settings.getValue(this.fractionKey) || "0") : 0; - Settings.setValue(NEW_TOOLBAR_POSITION, true); + Settings.setValue(this.isNewPositionKey, true); var recommendedRect = Controller.getRecommendedOverlayRect(); var screenSize = { x: recommendedRect.width, y: recommendedRect.height };