Browse Source

Add thumbColor in sliders

Patbox 5 years ago
parent
commit
3651391179
1 changed files with 16 additions and 0 deletions
  1. 16 0
      gui/src/2D/controls/sliders/slider.ts

+ 16 - 0
gui/src/2D/controls/sliders/slider.ts

@@ -9,6 +9,7 @@ import { Measure } from '../../measure';
 export class Slider extends BaseSlider {
     private _background = "black";
     private _borderColor = "white";
+    private _thumbColor = "";
     private _isThumbCircle = false;
     protected _displayValueBar = true;
 
@@ -53,6 +54,20 @@ export class Slider extends BaseSlider {
         this._background = value;
         this._markAsDirty();
     }
+    
+    /** Gets or sets thumb's color */
+    public get thumbColor(): string {
+        return this._thumbColor;
+    }
+    
+    public set thumbColor(value: string) {
+        if (this._thumbColor === value) {
+            return;
+        }
+    
+        this._thumbColor = value;
+        this._markAsDirty();
+    }
 
     /** Gets or sets a boolean indicating if the thumb should be round or square */
     public get isThumbCircle(): boolean {
@@ -193,6 +208,7 @@ export class Slider extends BaseSlider {
         }
 
         // Thumb
+        context.fillStyle = this._thumbColor || this.color;
         if (this.displayThumb) {
             if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {
                 context.shadowColor = this.shadowColor;