|
@@ -147,17 +147,19 @@ module BABYLON.GUI {
|
|
public _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void {
|
|
public _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void {
|
|
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
|
|
var effectiveThumbWidth;
|
|
var effectiveThumbWidth;
|
|
var effectiveBarOffset;
|
|
var effectiveBarOffset;
|
|
|
|
|
|
|
|
+ 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._thumbWidth.isPixel) {
|
|
if (this._thumbWidth.isPixel) {
|
|
effectiveThumbWidth = Math.min(this._thumbWidth.getValue(this._host), this._currentMeasure.height);
|
|
effectiveThumbWidth = Math.min(this._thumbWidth.getValue(this._host), this._currentMeasure.height);
|
|
} else {
|
|
} else {
|
|
@@ -179,18 +181,33 @@ module BABYLON.GUI {
|
|
context.fillStyle = this._background;
|
|
context.fillStyle = this._background;
|
|
context.fillRect(left, this._currentMeasure.top + effectiveBarOffset, width, this._currentMeasure.height - effectiveBarOffset * 2);
|
|
context.fillRect(left, this._currentMeasure.top + effectiveBarOffset, width, this._currentMeasure.height - effectiveBarOffset * 2);
|
|
|
|
|
|
|
|
+ if(this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY){
|
|
|
|
+ context.shadowBlur = 0;
|
|
|
|
+ context.shadowOffsetX = 0;
|
|
|
|
+ context.shadowOffsetY = 0;
|
|
|
|
+ }
|
|
|
|
+
|
|
context.fillStyle = this.color;
|
|
context.fillStyle = this.color;
|
|
context.fillRect(left, this._currentMeasure.top + effectiveBarOffset, thumbPosition, this._currentMeasure.height - effectiveBarOffset * 2);
|
|
context.fillRect(left, this._currentMeasure.top + effectiveBarOffset, thumbPosition, this._currentMeasure.height - effectiveBarOffset * 2);
|
|
|
|
|
|
|
|
+ if(this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY){
|
|
|
|
+ context.shadowColor = this.shadowColor;
|
|
|
|
+ context.shadowBlur = this.shadowBlur;
|
|
|
|
+ context.shadowOffsetX = this.shadowOffsetX;
|
|
|
|
+ context.shadowOffsetY = this.shadowOffsetY;
|
|
|
|
+ }
|
|
|
|
+
|
|
// Thumb
|
|
// Thumb
|
|
if (this._isThumbCircle) {
|
|
if (this._isThumbCircle) {
|
|
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;
|
|
|
|
|
|
+ if(this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY){
|
|
|
|
+ context.shadowBlur = 0;
|
|
|
|
+ context.shadowOffsetX = 0;
|
|
|
|
+ context.shadowOffsetY = 0;
|
|
|
|
+ }
|
|
|
|
|
|
context.strokeStyle = this._borderColor;
|
|
context.strokeStyle = this._borderColor;
|
|
context.stroke();
|
|
context.stroke();
|
|
@@ -198,9 +215,11 @@ module BABYLON.GUI {
|
|
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;
|
|
|
|
|
|
+ if(this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY){
|
|
|
|
+ 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);
|