SVGHMI: Meter widget accepts 2 arguments : min and max, taken in account when min or max text element is missing
--- 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 @@
</xsl:text>
<xsl:text> init: function() {
</xsl:text>
- <xsl:text> let min = this.min_elt ? Number(this.min_elt.textContent) : 0;
-</xsl:text>
- <xsl:text> let max = this.max_elt ? Number(this.max_elt.textContent) : 100;
+ <xsl:text> let min = this.min_elt ?
+</xsl:text>
+ <xsl:text> Number(this.min_elt.textContent) :
+</xsl:text>
+ <xsl:text> this.args.length >= 1 ? this.args[0] : 0;
+</xsl:text>
+ <xsl:text> let max = this.max_elt ?
+</xsl:text>
+ <xsl:text> Number(this.max_elt.textContent) :
+</xsl:text>
+ <xsl:text> this.args.length >= 2 ? this.args[1] : 100;
</xsl:text>
<xsl:text> this.range = [min, max, this.range_elt.getTotalLength()]
</xsl:text>
--- 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);
| },