mirror of
https://github.com/JulianGro/overte.git
synced 2025-08-04 07:24:57 +02:00
Cleanup implementation of toolbar titlebar
This commit is contained in:
parent
694a051724
commit
666eaa81fe
1 changed files with 8 additions and 9 deletions
|
@ -131,13 +131,13 @@ ToolBar = function(x, y, direction) {
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.y = y;
|
this.y = y;
|
||||||
this.width = 0;
|
this.width = 0;
|
||||||
this.height = 0;
|
this.height = ToolBar.TITLE_BAR_HEIGHT;
|
||||||
this.back = this.back = Overlays.addOverlay("text", {
|
this.back = this.back = Overlays.addOverlay("text", {
|
||||||
backgroundColor: { red: 255, green: 255, blue: 255 },
|
backgroundColor: { red: 255, green: 255, blue: 255 },
|
||||||
x: this.x,
|
x: this.x,
|
||||||
y: this.y - ToolBar.TITLE_BAR_HEIGHT,
|
y: this.y - ToolBar.TITLE_BAR_HEIGHT,
|
||||||
width: this.width,
|
width: this.width,
|
||||||
height: this.height + ToolBar.TITLE_BAR_HEIGHT,
|
height: this.height,
|
||||||
alpha: 1.0,
|
alpha: 1.0,
|
||||||
backgroundAlpha: 1.0,
|
backgroundAlpha: 1.0,
|
||||||
visible: false
|
visible: false
|
||||||
|
@ -161,7 +161,7 @@ ToolBar = function(x, y, direction) {
|
||||||
Overlays.editOverlay(this.back, {
|
Overlays.editOverlay(this.back, {
|
||||||
width: this.width +
|
width: this.width +
|
||||||
((direction == ToolBar.HORIZONTAL) ? 1 : 2) * ToolBar.SPACING,
|
((direction == ToolBar.HORIZONTAL) ? 1 : 2) * ToolBar.SPACING,
|
||||||
height: this.height + ToolBar.TITLE_BAR_HEIGHT +
|
height: this.height +
|
||||||
((direction == ToolBar.VERTICAL) ? 1 : 2) * ToolBar.SPACING,
|
((direction == ToolBar.VERTICAL) ? 1 : 2) * ToolBar.SPACING,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -201,7 +201,7 @@ ToolBar = function(x, y, direction) {
|
||||||
Overlays.editOverlay(this.back, {
|
Overlays.editOverlay(this.back, {
|
||||||
width: this.width +
|
width: this.width +
|
||||||
((direction == ToolBar.HORIZONTAL) ? 1 : 2) * ToolBar.SPACING,
|
((direction == ToolBar.HORIZONTAL) ? 1 : 2) * ToolBar.SPACING,
|
||||||
height: this.height + ToolBar.TITLE_BAR_HEIGHT +
|
height: this.height +
|
||||||
((direction == ToolBar.VERTICAL) ? 1 : 2) * ToolBar.SPACING,
|
((direction == ToolBar.VERTICAL) ? 1 : 2) * ToolBar.SPACING,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -218,7 +218,7 @@ ToolBar = function(x, y, direction) {
|
||||||
if (this.back != null) {
|
if (this.back != null) {
|
||||||
Overlays.editOverlay(this.back, {
|
Overlays.editOverlay(this.back, {
|
||||||
width: this.width + 2 * ToolBar.SPACING,
|
width: this.width + 2 * ToolBar.SPACING,
|
||||||
height: this.height + ToolBar.TITLE_BAR_HEIGHT + 2 * ToolBar.SPACING
|
height: this.height + 2 * ToolBar.SPACING
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -234,7 +234,7 @@ ToolBar = function(x, y, direction) {
|
||||||
if (this.back != null) {
|
if (this.back != null) {
|
||||||
Overlays.editOverlay(this.back, {
|
Overlays.editOverlay(this.back, {
|
||||||
x: x - ToolBar.SPACING,
|
x: x - ToolBar.SPACING,
|
||||||
y: y - ToolBar.TITLE_BAR_HEIGHT - ToolBar.SPACING
|
y: y - ToolBar.SPACING
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
this.save();
|
this.save();
|
||||||
|
@ -265,7 +265,7 @@ ToolBar = function(x, y, direction) {
|
||||||
Overlays.editOverlay(this.back, {
|
Overlays.editOverlay(this.back, {
|
||||||
width: this.width +
|
width: this.width +
|
||||||
((direction == ToolBar.HORIZONTAL) ? 1 : 2) * ToolBar.SPACING,
|
((direction == ToolBar.HORIZONTAL) ? 1 : 2) * ToolBar.SPACING,
|
||||||
height: this.height + ToolBar.TITLE_BAR_HEIGHT +
|
height: this.height +
|
||||||
((direction == ToolBar.VERTICAL) ? 1 : 2) * ToolBar.SPACING,
|
((direction == ToolBar.VERTICAL) ? 1 : 2) * ToolBar.SPACING,
|
||||||
visible: true,
|
visible: true,
|
||||||
backgroundColor: color,
|
backgroundColor: color,
|
||||||
|
@ -333,9 +333,8 @@ ToolBar = function(x, y, direction) {
|
||||||
this.contains = function (xOrPoint, optionalY) {
|
this.contains = function (xOrPoint, optionalY) {
|
||||||
var x = (optionalY === undefined) ? xOrPoint.x : xOrPoint,
|
var x = (optionalY === undefined) ? xOrPoint.x : xOrPoint,
|
||||||
y = (optionalY === undefined) ? xOrPoint.y : optionalY;
|
y = (optionalY === undefined) ? xOrPoint.y : optionalY;
|
||||||
y += ToolBar.TITLE_BAR_HEIGHT;
|
|
||||||
return (that.x <= x) && (x <= (that.x + that.width)) &&
|
return (that.x <= x) && (x <= (that.x + that.width)) &&
|
||||||
(that.y <= y) && (y <= (that.y + that.height + ToolBar.TITLE_BAR_HEIGHT));
|
(that.y <= y) && (y <= (that.y + that.height));
|
||||||
}
|
}
|
||||||
that.hover = function (enable) {
|
that.hover = function (enable) {
|
||||||
that.isHovering = enable;
|
that.isHovering = enable;
|
||||||
|
|
Loading…
Reference in a new issue