# HG changeset patch # User Edouard Tisserant # Date 1583400183 -3600 # Node ID a5c781b2f8f95b972d4bd88150ab969d8f0ce21d # Parent 1b529ba018ad08efb5e93758692bac29cf568fc6 SVGHMI: Meter widget accepts 2 arguments : min and max, taken in account when min or max text element is missing diff -r 1b529ba018ad -r a5c781b2f8f9 svghmi/gen_index_xhtml.xslt --- a/svghmi/gen_index_xhtml.xslt Wed Mar 04 20:02:15 2020 +0100 +++ b/svghmi/gen_index_xhtml.xslt Thu Mar 05 10:23:03 2020 +0100 @@ -1332,9 +1332,17 @@ init: function() { - let min = this.min_elt ? Number(this.min_elt.textContent) : 0; - - let max = this.max_elt ? Number(this.max_elt.textContent) : 100; + let min = this.min_elt ? + + Number(this.min_elt.textContent) : + + this.args.length >= 1 ? this.args[0] : 0; + + let max = this.max_elt ? + + Number(this.max_elt.textContent) : + + this.args.length >= 2 ? this.args[1] : 100; this.range = [min, max, this.range_elt.getTotalLength()] diff -r 1b529ba018ad -r a5c781b2f8f9 svghmi/gen_index_xhtml.ysl2 --- a/svghmi/gen_index_xhtml.ysl2 Wed Mar 04 20:02:15 2020 +0100 +++ b/svghmi/gen_index_xhtml.ysl2 Thu Mar 05 10:23:03 2020 +0100 @@ -720,8 +720,12 @@ | origin: undefined, | range: undefined, | init: function() { - | let min = this.min_elt ? Number(this.min_elt.textContent) : 0; - | let max = this.max_elt ? Number(this.max_elt.textContent) : 100; + | let min = this.min_elt ? + | Number(this.min_elt.textContent) : + | this.args.length >= 1 ? this.args[0] : 0; + | let max = this.max_elt ? + | Number(this.max_elt.textContent) : + | this.args.length >= 2 ? this.args[1] : 100; | this.range = [min, max, this.range_elt.getTotalLength()] | this.origin = this.needle_elt.getPointAtLength(0); | },