From 3a28772729c372facdee1bb2716f779ae3e68834 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Wed, 16 Mar 2016 10:22:39 +1300 Subject: [PATCH] Regularize toolbar margins and make draggable from all four sides --- examples/directory.js | 1 - examples/edit.js | 2 -- examples/libraries/toolBars.js | 11 +++++------ examples/marketplace.js | 1 - 4 files changed, 5 insertions(+), 10 deletions(-) diff --git a/examples/directory.js b/examples/directory.js index 5d0de9cbc5..9a58ef7963 100644 --- a/examples/directory.js +++ b/examples/directory.js @@ -53,7 +53,6 @@ var toolBar = (function() { browseDirectoryButton; function initialize() { - ToolBar.SPACING = 16; toolBar = new ToolBar(0, 0, ToolBar.VERTICAL, "highfidelity.directory.toolbar", function(windowDimensions, toolbar) { return { x: windowDimensions.x - 8 - toolbar.width, diff --git a/examples/edit.js b/examples/edit.js index dbed4fbad9..b545b23564 100644 --- a/examples/edit.js +++ b/examples/edit.js @@ -190,8 +190,6 @@ var toolBar = (function() { }; }); - - activeButton = toolBar.addTool({ imageURL: toolIconUrl + "edit-01.svg", subImage: { diff --git a/examples/libraries/toolBars.js b/examples/libraries/toolBars.js index 6c01580ea6..28d7e76870 100644 --- a/examples/libraries/toolBars.js +++ b/examples/libraries/toolBars.js @@ -131,7 +131,7 @@ ToolBar = function(x, y, direction, optionalPersistenceKey, optionalInitialPosit this.x = x; this.y = y; this.width = 0; - this.height = ToolBar.TITLE_BAR_HEIGHT; + this.height = 0 this.backAlpha = 1.0; this.back = Overlays.addOverlay("rectangle", { color: { red: 255, green: 255, blue: 255 }, @@ -327,13 +327,13 @@ ToolBar = function(x, y, direction, optionalPersistenceKey, optionalInitialPosit } var that = this; - this.contains = function (xOrPoint, optionalY) { + this.contains = function (xOrPoint, optionalY) { // All four margins are draggable. var x = (optionalY === undefined) ? xOrPoint.x : xOrPoint, y = (optionalY === undefined) ? xOrPoint.y : optionalY; - return (that.x <= x) && (x <= (that.x + that.width)) && - (that.y <= y) && (y <= (that.y + that.height)); + return ((that.x - ToolBar.SPACING) <= x) && (x <= (that.x + that.width + ToolBar.SPACING)) && + ((that.y - ToolBar.SPACING) <= y) && (y <= (that.y + that.height)); } - that.hover = function (enable) { // Can be overriden or extended by clients. + that.hover = function (enable) { // Can be overridden or extended by clients. that.isHovering = enable; if (that.back) { Overlays.editOverlay(this.back, { @@ -434,4 +434,3 @@ ToolBar = function(x, y, direction, optionalPersistenceKey, optionalInitialPosit ToolBar.SPACING = 4; ToolBar.VERTICAL = 0; ToolBar.HORIZONTAL = 1; -ToolBar.TITLE_BAR_HEIGHT = 10; diff --git a/examples/marketplace.js b/examples/marketplace.js index 1638032154..731b195adb 100644 --- a/examples/marketplace.js +++ b/examples/marketplace.js @@ -58,7 +58,6 @@ var toolBar = (function() { browseMarketplaceButton; function initialize() { - ToolBar.SPACING = 16; toolBar = new ToolBar(0, 0, ToolBar.VERTICAL, "highfidelity.marketplace.toolbar", function(windowDimensions, toolbar) { return { x: windowDimensions.x - 8 - toolbar.width,