|
@@ -800,6 +800,10 @@ var BABYLON;
|
|
this.isHitTestVisible = true;
|
|
this.isHitTestVisible = true;
|
|
this.isPointerBlocker = false;
|
|
this.isPointerBlocker = false;
|
|
this.isFocusInvisible = false;
|
|
this.isFocusInvisible = false;
|
|
|
|
+ this.shadowOffsetX = 0;
|
|
|
|
+ this.shadowOffsetY = 0;
|
|
|
|
+ this.shadowBlur = 0;
|
|
|
|
+ this.shadowColor = '#000';
|
|
this._linkOffsetX = new GUI.ValueAndUnit(0);
|
|
this._linkOffsetX = new GUI.ValueAndUnit(0);
|
|
this._linkOffsetY = new GUI.ValueAndUnit(0);
|
|
this._linkOffsetY = new GUI.ValueAndUnit(0);
|
|
/**
|
|
/**
|
|
@@ -1449,7 +1453,19 @@ var BABYLON;
|
|
};
|
|
};
|
|
Control.prototype._clip = function (context) {
|
|
Control.prototype._clip = function (context) {
|
|
context.beginPath();
|
|
context.beginPath();
|
|
- context.rect(this._currentMeasure.left, this._currentMeasure.top, this._currentMeasure.width, this._currentMeasure.height);
|
|
|
|
|
|
+ if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {
|
|
|
|
+ var shadowOffsetX = this.shadowOffsetX;
|
|
|
|
+ var shadowOffsetY = this.shadowOffsetY;
|
|
|
|
+ var shadowBlur = this.shadowBlur;
|
|
|
|
+ var leftShadowOffset = Math.min(Math.min(shadowOffsetX, 0) - shadowBlur * 2, 0);
|
|
|
|
+ var rightShadowOffset = Math.max(Math.max(shadowOffsetX, 0) + shadowBlur * 2, 0);
|
|
|
|
+ var topShadowOffset = Math.min(Math.min(shadowOffsetY, 0) - shadowBlur * 2, 0);
|
|
|
|
+ var bottomShadowOffset = Math.max(Math.max(shadowOffsetY, 0) + shadowBlur * 2, 0);
|
|
|
|
+ context.rect(this._currentMeasure.left + leftShadowOffset, this._currentMeasure.top + topShadowOffset, this._currentMeasure.width + rightShadowOffset - leftShadowOffset, this._currentMeasure.height + bottomShadowOffset - topShadowOffset);
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ context.rect(this._currentMeasure.left, this._currentMeasure.top, this._currentMeasure.width, this._currentMeasure.height);
|
|
|
|
+ }
|
|
};
|
|
};
|
|
Control.prototype._measure = function () {
|
|
Control.prototype._measure = function () {
|
|
// Width / Height
|
|
// Width / Height
|
|
@@ -1771,6 +1787,10 @@ var BABYLON;
|
|
panel.addControl(control);
|
|
panel.addControl(control);
|
|
header.paddingRight = "5px";
|
|
header.paddingRight = "5px";
|
|
}
|
|
}
|
|
|
|
+ header.shadowBlur = control.shadowBlur;
|
|
|
|
+ header.shadowColor = control.shadowColor;
|
|
|
|
+ header.shadowOffsetX = control.shadowOffsetX;
|
|
|
|
+ header.shadowOffsetY = control.shadowOffsetY;
|
|
return panel;
|
|
return panel;
|
|
};
|
|
};
|
|
Control.drawEllipse = function (x, y, width, height, context) {
|
|
Control.drawEllipse = function (x, y, width, height, context) {
|
|
@@ -1904,8 +1924,19 @@ var BABYLON;
|
|
};
|
|
};
|
|
Container.prototype._localDraw = function (context) {
|
|
Container.prototype._localDraw = function (context) {
|
|
if (this._background) {
|
|
if (this._background) {
|
|
|
|
+ if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {
|
|
|
|
+ context.shadowColor = this.shadowColor;
|
|
|
|
+ context.shadowBlur = this.shadowBlur;
|
|
|
|
+ context.shadowOffsetX = this.shadowOffsetX;
|
|
|
|
+ context.shadowOffsetY = this.shadowOffsetY;
|
|
|
|
+ }
|
|
context.fillStyle = this._background;
|
|
context.fillStyle = this._background;
|
|
context.fillRect(this._currentMeasure.left, this._currentMeasure.top, this._currentMeasure.width, this._currentMeasure.height);
|
|
context.fillRect(this._currentMeasure.left, this._currentMeasure.top, this._currentMeasure.width, this._currentMeasure.height);
|
|
|
|
+ if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {
|
|
|
|
+ context.shadowBlur = 0;
|
|
|
|
+ context.shadowOffsetX = 0;
|
|
|
|
+ context.shadowOffsetY = 0;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
};
|
|
};
|
|
Container.prototype._link = function (root, host) {
|
|
Container.prototype._link = function (root, host) {
|
|
@@ -2170,6 +2201,12 @@ var BABYLON;
|
|
};
|
|
};
|
|
Rectangle.prototype._localDraw = function (context) {
|
|
Rectangle.prototype._localDraw = function (context) {
|
|
context.save();
|
|
context.save();
|
|
|
|
+ if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {
|
|
|
|
+ context.shadowColor = this.shadowColor;
|
|
|
|
+ context.shadowBlur = this.shadowBlur;
|
|
|
|
+ context.shadowOffsetX = this.shadowOffsetX;
|
|
|
|
+ context.shadowOffsetY = this.shadowOffsetY;
|
|
|
|
+ }
|
|
if (this._background) {
|
|
if (this._background) {
|
|
context.fillStyle = this._background;
|
|
context.fillStyle = this._background;
|
|
if (this._cornerRadius) {
|
|
if (this._cornerRadius) {
|
|
@@ -2181,6 +2218,11 @@ var BABYLON;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (this._thickness) {
|
|
if (this._thickness) {
|
|
|
|
+ if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {
|
|
|
|
+ context.shadowBlur = 0;
|
|
|
|
+ context.shadowOffsetX = 0;
|
|
|
|
+ context.shadowOffsetY = 0;
|
|
|
|
+ }
|
|
if (this.color) {
|
|
if (this.color) {
|
|
context.strokeStyle = this.color;
|
|
context.strokeStyle = this.color;
|
|
}
|
|
}
|
|
@@ -2268,11 +2310,22 @@ var BABYLON;
|
|
};
|
|
};
|
|
Ellipse.prototype._localDraw = function (context) {
|
|
Ellipse.prototype._localDraw = function (context) {
|
|
context.save();
|
|
context.save();
|
|
|
|
+ if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {
|
|
|
|
+ context.shadowColor = this.shadowColor;
|
|
|
|
+ context.shadowBlur = this.shadowBlur;
|
|
|
|
+ context.shadowOffsetX = this.shadowOffsetX;
|
|
|
|
+ context.shadowOffsetY = this.shadowOffsetY;
|
|
|
|
+ }
|
|
GUI.Control.drawEllipse(this._currentMeasure.left + this._currentMeasure.width / 2, this._currentMeasure.top + this._currentMeasure.height / 2, this._currentMeasure.width / 2 - this._thickness / 2, this._currentMeasure.height / 2 - this._thickness / 2, context);
|
|
GUI.Control.drawEllipse(this._currentMeasure.left + this._currentMeasure.width / 2, this._currentMeasure.top + this._currentMeasure.height / 2, this._currentMeasure.width / 2 - this._thickness / 2, this._currentMeasure.height / 2 - this._thickness / 2, context);
|
|
if (this._background) {
|
|
if (this._background) {
|
|
context.fillStyle = this._background;
|
|
context.fillStyle = this._background;
|
|
context.fill();
|
|
context.fill();
|
|
}
|
|
}
|
|
|
|
+ if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {
|
|
|
|
+ context.shadowBlur = 0;
|
|
|
|
+ context.shadowOffsetX = 0;
|
|
|
|
+ context.shadowOffsetY = 0;
|
|
|
|
+ }
|
|
if (this._thickness) {
|
|
if (this._thickness) {
|
|
if (this.color) {
|
|
if (this.color) {
|
|
context.strokeStyle = this.color;
|
|
context.strokeStyle = this.color;
|
|
@@ -2466,6 +2519,12 @@ var BABYLON;
|
|
};
|
|
};
|
|
Line.prototype._draw = function (parentMeasure, context) {
|
|
Line.prototype._draw = function (parentMeasure, context) {
|
|
context.save();
|
|
context.save();
|
|
|
|
+ if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {
|
|
|
|
+ context.shadowColor = this.shadowColor;
|
|
|
|
+ context.shadowBlur = this.shadowBlur;
|
|
|
|
+ context.shadowOffsetX = this.shadowOffsetX;
|
|
|
|
+ context.shadowOffsetY = this.shadowOffsetY;
|
|
|
|
+ }
|
|
this._applyStates(context);
|
|
this._applyStates(context);
|
|
if (this._processMeasures(parentMeasure, context)) {
|
|
if (this._processMeasures(parentMeasure, context)) {
|
|
context.strokeStyle = this.color;
|
|
context.strokeStyle = this.color;
|
|
@@ -2663,6 +2722,10 @@ var BABYLON;
|
|
};
|
|
};
|
|
Slider.prototype._draw = function (parentMeasure, context) {
|
|
Slider.prototype._draw = function (parentMeasure, context) {
|
|
context.save();
|
|
context.save();
|
|
|
|
+ context.shadowColor = this.shadowColor;
|
|
|
|
+ context.shadowBlur = this.shadowBlur;
|
|
|
|
+ context.shadowOffsetX = this.shadowOffsetX;
|
|
|
|
+ context.shadowOffsetY = this.shadowOffsetY;
|
|
this._applyStates(context);
|
|
this._applyStates(context);
|
|
if (this._processMeasures(parentMeasure, context)) {
|
|
if (this._processMeasures(parentMeasure, context)) {
|
|
// Main bar
|
|
// Main bar
|
|
@@ -2693,11 +2756,17 @@ var BABYLON;
|
|
context.beginPath();
|
|
context.beginPath();
|
|
context.arc(left + thumbPosition, this._currentMeasure.top + this._currentMeasure.height / 2, effectiveThumbWidth / 2, 0, 2 * Math.PI);
|
|
context.arc(left + thumbPosition, this._currentMeasure.top + this._currentMeasure.height / 2, effectiveThumbWidth / 2, 0, 2 * Math.PI);
|
|
context.fill();
|
|
context.fill();
|
|
|
|
+ context.shadowBlur = 0;
|
|
|
|
+ context.shadowOffsetX = 0;
|
|
|
|
+ context.shadowOffsetY = 0;
|
|
context.strokeStyle = this._borderColor;
|
|
context.strokeStyle = this._borderColor;
|
|
context.stroke();
|
|
context.stroke();
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
context.fillRect(left + thumbPosition - effectiveThumbWidth / 2, this._currentMeasure.top, effectiveThumbWidth, this._currentMeasure.height);
|
|
context.fillRect(left + thumbPosition - effectiveThumbWidth / 2, this._currentMeasure.top, effectiveThumbWidth, this._currentMeasure.height);
|
|
|
|
+ context.shadowBlur = 0;
|
|
|
|
+ context.shadowOffsetX = 0;
|
|
|
|
+ context.shadowOffsetY = 0;
|
|
context.strokeStyle = this._borderColor;
|
|
context.strokeStyle = this._borderColor;
|
|
context.strokeRect(left + thumbPosition - effectiveThumbWidth / 2, this._currentMeasure.top, effectiveThumbWidth, this._currentMeasure.height);
|
|
context.strokeRect(left + thumbPosition - effectiveThumbWidth / 2, this._currentMeasure.top, effectiveThumbWidth, this._currentMeasure.height);
|
|
}
|
|
}
|
|
@@ -2821,8 +2890,19 @@ var BABYLON;
|
|
if (this._processMeasures(parentMeasure, context)) {
|
|
if (this._processMeasures(parentMeasure, context)) {
|
|
var actualWidth = this._currentMeasure.width - this._thickness;
|
|
var actualWidth = this._currentMeasure.width - this._thickness;
|
|
var actualHeight = this._currentMeasure.height - this._thickness;
|
|
var actualHeight = this._currentMeasure.height - this._thickness;
|
|
|
|
+ if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {
|
|
|
|
+ context.shadowColor = this.shadowColor;
|
|
|
|
+ context.shadowBlur = this.shadowBlur;
|
|
|
|
+ context.shadowOffsetX = this.shadowOffsetX;
|
|
|
|
+ context.shadowOffsetY = this.shadowOffsetY;
|
|
|
|
+ }
|
|
context.fillStyle = this._background;
|
|
context.fillStyle = this._background;
|
|
context.fillRect(this._currentMeasure.left + this._thickness / 2, this._currentMeasure.top + this._thickness / 2, actualWidth, actualHeight);
|
|
context.fillRect(this._currentMeasure.left + this._thickness / 2, this._currentMeasure.top + this._thickness / 2, actualWidth, actualHeight);
|
|
|
|
+ if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {
|
|
|
|
+ context.shadowBlur = 0;
|
|
|
|
+ context.shadowOffsetX = 0;
|
|
|
|
+ context.shadowOffsetY = 0;
|
|
|
|
+ }
|
|
if (this._isChecked) {
|
|
if (this._isChecked) {
|
|
context.fillStyle = this.color;
|
|
context.fillStyle = this.color;
|
|
var offsetWidth = actualWidth * this._checkSizeRatio;
|
|
var offsetWidth = actualWidth * this._checkSizeRatio;
|
|
@@ -2954,10 +3034,21 @@ var BABYLON;
|
|
if (this._processMeasures(parentMeasure, context)) {
|
|
if (this._processMeasures(parentMeasure, context)) {
|
|
var actualWidth = this._currentMeasure.width - this._thickness;
|
|
var actualWidth = this._currentMeasure.width - this._thickness;
|
|
var actualHeight = this._currentMeasure.height - this._thickness;
|
|
var actualHeight = this._currentMeasure.height - this._thickness;
|
|
|
|
+ if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {
|
|
|
|
+ context.shadowColor = this.shadowColor;
|
|
|
|
+ context.shadowBlur = this.shadowBlur;
|
|
|
|
+ context.shadowOffsetX = this.shadowOffsetX;
|
|
|
|
+ context.shadowOffsetY = this.shadowOffsetY;
|
|
|
|
+ }
|
|
// Outer
|
|
// Outer
|
|
GUI.Control.drawEllipse(this._currentMeasure.left + this._currentMeasure.width / 2, this._currentMeasure.top + this._currentMeasure.height / 2, this._currentMeasure.width / 2 - this._thickness / 2, this._currentMeasure.height / 2 - this._thickness / 2, context);
|
|
GUI.Control.drawEllipse(this._currentMeasure.left + this._currentMeasure.width / 2, this._currentMeasure.top + this._currentMeasure.height / 2, this._currentMeasure.width / 2 - this._thickness / 2, this._currentMeasure.height / 2 - this._thickness / 2, context);
|
|
context.fillStyle = this._background;
|
|
context.fillStyle = this._background;
|
|
context.fill();
|
|
context.fill();
|
|
|
|
+ if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {
|
|
|
|
+ context.shadowBlur = 0;
|
|
|
|
+ context.shadowOffsetX = 0;
|
|
|
|
+ context.shadowOffsetY = 0;
|
|
|
|
+ }
|
|
context.strokeStyle = this.color;
|
|
context.strokeStyle = this.color;
|
|
context.lineWidth = this._thickness;
|
|
context.lineWidth = this._thickness;
|
|
context.stroke();
|
|
context.stroke();
|
|
@@ -3101,6 +3192,12 @@ var BABYLON;
|
|
x = (width - textWidth) / 2;
|
|
x = (width - textWidth) / 2;
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
|
|
+ if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {
|
|
|
|
+ context.shadowColor = this.shadowColor;
|
|
|
|
+ context.shadowBlur = this.shadowBlur;
|
|
|
|
+ context.shadowOffsetX = this.shadowOffsetX;
|
|
|
|
+ context.shadowOffsetY = this.shadowOffsetY;
|
|
|
|
+ }
|
|
context.fillText(text, this._currentMeasure.left + x, y);
|
|
context.fillText(text, this._currentMeasure.left + x, y);
|
|
};
|
|
};
|
|
TextBlock.prototype._draw = function (parentMeasure, context) {
|
|
TextBlock.prototype._draw = function (parentMeasure, context) {
|
|
@@ -3399,6 +3496,12 @@ var BABYLON;
|
|
};
|
|
};
|
|
Image.prototype._draw = function (parentMeasure, context) {
|
|
Image.prototype._draw = function (parentMeasure, context) {
|
|
context.save();
|
|
context.save();
|
|
|
|
+ if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {
|
|
|
|
+ context.shadowColor = this.shadowColor;
|
|
|
|
+ context.shadowBlur = this.shadowBlur;
|
|
|
|
+ context.shadowOffsetX = this.shadowOffsetX;
|
|
|
|
+ context.shadowOffsetY = this.shadowOffsetY;
|
|
|
|
+ }
|
|
var x, y, width, height;
|
|
var x, y, width, height;
|
|
if (this.cellId == -1) {
|
|
if (this.cellId == -1) {
|
|
x = this._sourceLeft;
|
|
x = this._sourceLeft;
|
|
@@ -3871,8 +3974,20 @@ var BABYLON;
|
|
if (!this._colorWheelCanvas || this._colorWheelCanvas.width != radius * 2) {
|
|
if (!this._colorWheelCanvas || this._colorWheelCanvas.width != radius * 2) {
|
|
this._colorWheelCanvas = this._createColorWheelCanvas(radius, wheelThickness);
|
|
this._colorWheelCanvas = this._createColorWheelCanvas(radius, wheelThickness);
|
|
}
|
|
}
|
|
- context.drawImage(this._colorWheelCanvas, left, top);
|
|
|
|
this._updateSquareProps();
|
|
this._updateSquareProps();
|
|
|
|
+ if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {
|
|
|
|
+ context.shadowColor = this.shadowColor;
|
|
|
|
+ context.shadowBlur = this.shadowBlur;
|
|
|
|
+ context.shadowOffsetX = this.shadowOffsetX;
|
|
|
|
+ context.shadowOffsetY = this.shadowOffsetY;
|
|
|
|
+ context.fillRect(this._squareLeft, this._squareTop, this._squareSize, this._squareSize);
|
|
|
|
+ }
|
|
|
|
+ context.drawImage(this._colorWheelCanvas, left, top);
|
|
|
|
+ if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {
|
|
|
|
+ context.shadowBlur = 0;
|
|
|
|
+ context.shadowOffsetX = 0;
|
|
|
|
+ context.shadowOffsetY = 0;
|
|
|
|
+ }
|
|
this._drawGradientSquare(this._h, this._squareLeft, this._squareTop, this._squareSize, this._squareSize, context);
|
|
this._drawGradientSquare(this._h, this._squareLeft, this._squareTop, this._squareSize, this._squareSize, context);
|
|
var cx = this._squareLeft + this._squareSize * this._s;
|
|
var cx = this._squareLeft + this._squareSize * this._s;
|
|
var cy = this._squareTop + this._squareSize * (1 - this._v);
|
|
var cy = this._squareTop + this._squareSize * (1 - this._v);
|
|
@@ -4243,6 +4358,10 @@ var BABYLON;
|
|
context.save();
|
|
context.save();
|
|
this._applyStates(context);
|
|
this._applyStates(context);
|
|
if (this._processMeasures(parentMeasure, context)) {
|
|
if (this._processMeasures(parentMeasure, context)) {
|
|
|
|
+ context.shadowColor = this.shadowColor;
|
|
|
|
+ context.shadowBlur = this.shadowBlur;
|
|
|
|
+ context.shadowOffsetX = this.shadowOffsetX;
|
|
|
|
+ context.shadowOffsetY = this.shadowOffsetY;
|
|
// Background
|
|
// Background
|
|
if (this._isFocused) {
|
|
if (this._isFocused) {
|
|
if (this._focusedBackground) {
|
|
if (this._focusedBackground) {
|
|
@@ -4254,6 +4373,9 @@ var BABYLON;
|
|
context.fillStyle = this._background;
|
|
context.fillStyle = this._background;
|
|
context.fillRect(this._currentMeasure.left, this._currentMeasure.top, this._currentMeasure.width, this._currentMeasure.height);
|
|
context.fillRect(this._currentMeasure.left, this._currentMeasure.top, this._currentMeasure.width, this._currentMeasure.height);
|
|
}
|
|
}
|
|
|
|
+ context.shadowBlur = 0;
|
|
|
|
+ context.shadowOffsetX = 0;
|
|
|
|
+ context.shadowOffsetY = 0;
|
|
if (!this._fontOffset) {
|
|
if (!this._fontOffset) {
|
|
this._fontOffset = GUI.Control._GetFontOffset(context.font);
|
|
this._fontOffset = GUI.Control._GetFontOffset(context.font);
|
|
}
|
|
}
|
|
@@ -4420,6 +4542,10 @@ var BABYLON;
|
|
button.paddingBottom = propertySet && propertySet.paddingBottom ? propertySet.paddingBottom : this.defaultButtonPaddingBottom;
|
|
button.paddingBottom = propertySet && propertySet.paddingBottom ? propertySet.paddingBottom : this.defaultButtonPaddingBottom;
|
|
button.thickness = 0;
|
|
button.thickness = 0;
|
|
button.isFocusInvisible = true;
|
|
button.isFocusInvisible = true;
|
|
|
|
+ button.shadowColor = this.shadowColor;
|
|
|
|
+ button.shadowBlur = this.shadowBlur;
|
|
|
|
+ button.shadowOffsetX = this.shadowOffsetX;
|
|
|
|
+ button.shadowOffsetY = this.shadowOffsetY;
|
|
button.onPointerUpObservable.add(function () {
|
|
button.onPointerUpObservable.add(function () {
|
|
_this.onKeyPressObservable.notifyObservers(key);
|
|
_this.onKeyPressObservable.notifyObservers(key);
|
|
});
|
|
});
|