UI: Fixed gauge widgets incorrect display after work some time
This commit is contained in:
parent
72d7c0bb29
commit
266cdae02f
13
ui-ngx/patches/canvas-gauges+2.1.7.patch
Normal file
13
ui-ngx/patches/canvas-gauges+2.1.7.patch
Normal file
File diff suppressed because one or more lines are too long
@ -400,10 +400,8 @@ export class CanvasDigitalGauge extends BaseGauge {
|
||||
const context = this.contextValueClone;
|
||||
// clear the cache
|
||||
context.clearRect(x, y, w, h);
|
||||
context.save();
|
||||
|
||||
context.drawImage(canvas.elementClone, x, y, w, h);
|
||||
context.save();
|
||||
|
||||
drawDigitalValue(context, options, this.elementValueClone.renderedValue);
|
||||
|
||||
@ -426,10 +424,8 @@ export class CanvasDigitalGauge extends BaseGauge {
|
||||
const context = this.contextProgressClone;
|
||||
// clear the cache
|
||||
context.clearRect(x, y, w, h);
|
||||
context.save();
|
||||
|
||||
context.drawImage(this.elementValueClone, x, y, w, h);
|
||||
context.save();
|
||||
|
||||
if (Number(fixedProgress) > 0) {
|
||||
drawProgress(context, options, progress);
|
||||
@ -443,10 +439,8 @@ export class CanvasDigitalGauge extends BaseGauge {
|
||||
|
||||
// clear the canvas
|
||||
canvas.context.clearRect(x, y, w, h);
|
||||
canvas.context.save();
|
||||
|
||||
canvas.context.drawImage(this.elementProgressClone, x, y, w, h);
|
||||
canvas.context.save();
|
||||
|
||||
// @ts-ignore
|
||||
super.draw();
|
||||
@ -754,6 +748,7 @@ function drawDigitalTitle(context: DigitalGaugeCanvasRenderingContext2D, options
|
||||
context.font = Drawings.font(options, 'Title', fontSizeFactor);
|
||||
context.lineWidth = 0;
|
||||
drawText(context, options, 'Title', options.title.toUpperCase(), textX, textY);
|
||||
context.restore();
|
||||
}
|
||||
|
||||
function drawDigitalLabel(context: DigitalGaugeCanvasRenderingContext2D, options: CanvasDigitalGaugeOptions) {
|
||||
@ -772,6 +767,7 @@ function drawDigitalLabel(context: DigitalGaugeCanvasRenderingContext2D, options
|
||||
context.font = Drawings.font(options, 'Label', fontSizeFactor);
|
||||
context.lineWidth = 0;
|
||||
drawText(context, options, 'Label', options.label, textX, textY);
|
||||
context.restore();
|
||||
}
|
||||
|
||||
function drawDigitalMinMax(context: DigitalGaugeCanvasRenderingContext2D, options: CanvasDigitalGaugeOptions) {
|
||||
@ -789,6 +785,7 @@ function drawDigitalMinMax(context: DigitalGaugeCanvasRenderingContext2D, option
|
||||
context.lineWidth = 0;
|
||||
drawText(context, options, 'MinMax', options.minValue + '', minX, minY);
|
||||
drawText(context, options, 'MinMax', options.maxValue + '', maxX, maxY);
|
||||
context.restore();
|
||||
}
|
||||
|
||||
function drawDigitalValue(context: DigitalGaugeCanvasRenderingContext2D, options: CanvasDigitalGaugeOptions, value: any) {
|
||||
@ -811,6 +808,7 @@ function drawDigitalValue(context: DigitalGaugeCanvasRenderingContext2D, options
|
||||
context.font = Drawings.font(options, 'Value', fontSizeFactor);
|
||||
context.lineWidth = 0;
|
||||
drawText(context, options, 'Value', text, textX, textY);
|
||||
context.restore();
|
||||
}
|
||||
|
||||
function getProgressColor(progress: number, colorsRange: DigitalGaugeColorRange[]): string {
|
||||
@ -944,6 +942,7 @@ function drawTickBar(context: DigitalGaugeCanvasRenderingContext2D, tickValues:
|
||||
function drawProgress(context: DigitalGaugeCanvasRenderingContext2D,
|
||||
options: CanvasDigitalGaugeOptions, progress: number) {
|
||||
let neonColor;
|
||||
context.save();
|
||||
if (options.neonGlowBrightness) {
|
||||
context.currentColor = neonColor = getProgressColor(progress, options.neonColorsRange);
|
||||
} else {
|
||||
@ -1019,4 +1018,5 @@ function drawProgress(context: DigitalGaugeCanvasRenderingContext2D,
|
||||
true, options.colorTicks, options.tickWidth);
|
||||
}
|
||||
|
||||
context.restore();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user