diff --git a/src/Obj/Base/BaseSource/BaseModel/Model/_element.js b/src/Obj/Base/BaseSource/BaseModel/Model/_element.js index 9301b0f..1385d7a 100644 --- a/src/Obj/Base/BaseSource/BaseModel/Model/_element.js +++ b/src/Obj/Base/BaseSource/BaseModel/Model/_element.js @@ -56,7 +56,7 @@ function html(that) {
- 固定大小 + 固定大小
diff --git a/src/Obj/Base/PolyhedronObject/eventBinding.js b/src/Obj/Base/PolyhedronObject/eventBinding.js index e6b547d..6e7380d 100644 --- a/src/Obj/Base/PolyhedronObject/eventBinding.js +++ b/src/Obj/Base/PolyhedronObject/eventBinding.js @@ -21,6 +21,7 @@ class eventBinding { let Event = [] let isEvent = false let removeName = [] + let blurEvent = () => { } if (!elements[i] || !elements[i].attributes) { continue } @@ -36,7 +37,8 @@ class eventBinding { Event.push((e) => { let value = e.target.value if (e.target.type == 'number') { - if (e.data != '.' && (e.data != '-' || e.target.value)) { + let str = e.target.value + '' + if (e.data != '.' && (e.data != '-' || e.target.value) && !(str.charAt(str.length - 1) == '0' && e.target.value.toString().includes('.')) && e.target.value != '0') { value = Number(value) if((e.target.max) && value>Number(e.target.max)) { value = Number(e.target.max) @@ -57,6 +59,22 @@ class eventBinding { that[m.value] = value } }) + blurEvent = (e) => { + let value = e.target.value + if (e.target.value || (e.target.dataset.null !== 'undefined' && e.target.dataset.null !== '' && !Boolean(e.target.dataset.null))) { + value = Number(value) + if ((e.target.max) && value > Number(e.target.max)) { + value = Number(e.target.max) + } + if ((e.target.min) && value < Number(e.target.min)) { + value = Number(e.target.min) + } + if ((e.target.dataset.min) && value < Number(e.target.dataset.min)) { + value = Number(e.target.dataset.min) + } + } + that[m.value] = value + } if(elements[i].nodeName=='IMG') { elements[i].src = that[m.value] } @@ -114,6 +132,7 @@ class eventBinding { Event[t](e) } }); + elements[i].addEventListener('blur', blurEvent) } } } diff --git a/src/Obj/Base/WallRealStereoscopic/eventBinding.js b/src/Obj/Base/WallRealStereoscopic/eventBinding.js index 4554edc..60f6829 100644 --- a/src/Obj/Base/WallRealStereoscopic/eventBinding.js +++ b/src/Obj/Base/WallRealStereoscopic/eventBinding.js @@ -21,6 +21,7 @@ class eventBinding { let Event = [] let isEvent = false let removeName = [] + let blurEvent = ()=>{} if (!elements[i] ||!elements[i].attributes) { continue; } @@ -37,14 +38,14 @@ class eventBinding { let value = e.target.value if (e.target.type == 'number') { if (e.data != '.' && (e.data != '-' || e.target.value)) { - value = Number(value) - if((e.target.max) && value>Number(e.target.max)) { + let v = Number(value) + if((e.target.max) && v>Number(e.target.max)) { value = Number(e.target.max) } - if((e.target.min) && value { + let value = e.target.value + if (e.target.value || (e.target.dataset.null !== 'undefined' && e.target.dataset.null !== '' && !Boolean(e.target.dataset.null))) { + value = Number(value) + if ((e.target.max) && value > Number(e.target.max)) { + value = Number(e.target.max) + } + if ((e.target.min) && value < Number(e.target.min)) { + value = Number(e.target.min) + } + if ((e.target.dataset.min) && value < Number(e.target.dataset.min)) { + value = Number(e.target.dataset.min) + } + } + that[m.value] = value + } if(elements[i].nodeName=='IMG') { elements[i].src = that[m.value] } @@ -111,6 +128,9 @@ class eventBinding { Event[t](e) } }); + elements[i].addEventListener('blur', (e) => { + blurEvent(e) + }); } } } diff --git a/src/Obj/Base/WallStereoscopic/eventBinding.js b/src/Obj/Base/WallStereoscopic/eventBinding.js index 53d9ed3..52240e6 100644 --- a/src/Obj/Base/WallStereoscopic/eventBinding.js +++ b/src/Obj/Base/WallStereoscopic/eventBinding.js @@ -21,8 +21,9 @@ class eventBinding { let Event = [] let isEvent = false let removeName = [] - if (!elements[i] ||!elements[i].attributes) { - continue; + let blurEvent = () => { } + if (!elements[i] || !elements[i].attributes) { + continue; } for (let m of elements[i].attributes) { switch (m.name) { @@ -37,11 +38,11 @@ class eventBinding { let value = e.target.value if (e.target.type == 'number') { if (e.data != '.' && (e.data != '-' || e.target.value)) { - value = Number(value) - if((e.target.max) && value>Number(e.target.max)) { + let v = Number(value) + if ((e.target.max) && v > Number(e.target.max)) { value = Number(e.target.max) } - if((e.target.min) && value { + let value = e.target.value + if (e.target.value || (e.target.dataset.null !== 'undefined' && e.target.dataset.null !== '' && !Boolean(e.target.dataset.null))) { + value = Number(value) + if ((e.target.max) && value > Number(e.target.max)) { + value = Number(e.target.max) + } + if ((e.target.min) && value < Number(e.target.min)) { + value = Number(e.target.min) + } + if ((e.target.dataset.min) && value < Number(e.target.dataset.min)) { + value = Number(e.target.dataset.min) + } + } + that[m.value] = value + } + + + if (elements[i].nodeName == 'IMG') { elements[i].src = that[m.value] } else { elements[i].value = that[m.value] } } - if(this.element[m.value]) { + if (this.element[m.value]) { this.element[m.value].push(elements[i]) } else { @@ -81,7 +100,7 @@ class eventBinding { isEvent = true Event.push((e) => { let value = e.target.value - if(e.target.type == 'number' && value!='') { + if (e.target.type == 'number' && value != '') { value = Number(value) e.target.value = value } @@ -94,7 +113,7 @@ class eventBinding { } // elements[i].attributes[m] = undefined } - for(let n=0;n { + blurEvent(e) + }); } } } diff --git a/src/Obj/Base/WaterSurface/eventBinding.js b/src/Obj/Base/WaterSurface/eventBinding.js index ccbf026..1fe3d17 100644 --- a/src/Obj/Base/WaterSurface/eventBinding.js +++ b/src/Obj/Base/WaterSurface/eventBinding.js @@ -35,7 +35,8 @@ class eventBinding { else { Event.push((e) => { let value = e.target.value - if (e.target.type == 'number') { + let str = e.target.value + '' + if (e.target.type == 'number' && !(str.charAt(str.length - 1) == '0' && e.target.value.toString().includes('.'))) { value = Number(value) } that[m.value] = value diff --git a/src/Obj/Element/Dialog/eventBinding.js b/src/Obj/Element/Dialog/eventBinding.js index 70cecf8..c47327f 100644 --- a/src/Obj/Element/Dialog/eventBinding.js +++ b/src/Obj/Element/Dialog/eventBinding.js @@ -45,8 +45,14 @@ class EventBinding { let value = e.target.value value = Number(value) if (e.data != '.' && (e.data != '-' || e.target.value)) { - if (((!e.target.max) && (!e.target.min)) || ((value <= Number(e.target.max)) && value >= Number(e.target.min))) { - that[m.value] = value + if ((e.target.max) && value > Number(e.target.max)) { + value = Number(e.target.max) + } + if ((e.target.min) && value < Number(e.target.min)) { + value = Number(e.target.min) + } + if ((e.target.dataset.min) && value < Number(e.target.dataset.min)) { + value = Number(e.target.dataset.min) } } }