Regularize toolbar margins and make draggable from all four sides

This commit is contained in:
David Rowe 2016-03-16 10:22:39 +13:00
parent a5e0d93dd5
commit 3a28772729
4 changed files with 5 additions and 10 deletions

View file

@ -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,

View file

@ -190,8 +190,6 @@ var toolBar = (function() {
};
});
activeButton = toolBar.addTool({
imageURL: toolIconUrl + "edit-01.svg",
subImage: {

View file

@ -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;

View file

@ -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,