JSDoc complete type check

This commit is contained in:
barsdeveloper
2022-10-09 11:43:28 +02:00
parent 91e1e0885e
commit cdc5e5b91b
68 changed files with 1603 additions and 648 deletions

View File

@@ -1,15 +1,36 @@
import { html } from "lit"
import IInputPinTemplate from "./IInputPinTemplate"
import RealPinTemplate from "./RealPinTemplate"
import Utility from "../Utility"
import VectorEntity from "../entity/VectorEntity"
/**
* @typedef {import("../element/PinElement").default} PinElement
* @typedef {import("../entity/LinearColorEntity").default} LinearColorEntity}
* @typedef {import("../entity/LinearColorEntity").default} LinearColorEntity
*/
export default class VectorPinTemplate extends RealPinTemplate {
/**
* @template {VectorEntity} T
* @extends IInputPinTemplate<T>
*/
export default class VectorPinTemplate extends IInputPinTemplate {
/** @param {String[]} values */
setInputs(values = [], updateDefaultValue = false) {
if (!values || values.length == 0) {
values = [this.getInput()]
}
let parsedValues = []
for (let i = 0; i < values.length; ++i) {
let num = parseFloat(values[i])
if (isNaN(num)) {
num = 0
updateDefaultValue = false
}
parsedValues.push(num)
}
super.setInputs(values, false)
this.setDefaultValue(parsedValues, values)
}
setDefaultValue(values = [], rawValues = values) {
if (!(this.element.entity.DefaultValue instanceof VectorEntity)) {
@@ -27,27 +48,21 @@ export default class VectorPinTemplate extends RealPinTemplate {
<div class="ueb-pin-input-wrapper">
<span class="ueb-pin-input-label">X</span>
<div class="ueb-pin-input">
<span class="ueb-pin-input-content ueb-pin-input-x" role="textbox" contenteditable="true" .innerText="${IInputPinTemplate.stringFromUEToInput(
Utility.minDecimals(
this.element.entity.getDefaultValue().X
)
)}"></span>
<span class="ueb-pin-input-content ueb-pin-input-x" role="textbox" contenteditable="true" .innerText="${IInputPinTemplate
.stringFromUEToInput(Utility.minDecimals(this.element.entity.getDefaultValue().X))
}"></span>
</div>
<span class="ueb-pin-input-label">Y</span>
<div class="ueb-pin-input">
<span class="ueb-pin-input-content ueb-pin-input-y" role="textbox" contenteditable="true" .innerText="${IInputPinTemplate.stringFromUEToInput(
Utility.minDecimals(
this.element.entity.getDefaultValue().Y
)
)}"></span>
<span class="ueb-pin-input-content ueb-pin-input-y" role="textbox" contenteditable="true" .innerText="${IInputPinTemplate
.stringFromUEToInput(Utility.minDecimals(this.element.entity.getDefaultValue().Y))
}"></span>
</div>
<span class="ueb-pin-input-label">Z</span>
<div class="ueb-pin-input">
<span class="ueb-pin-input-content ueb-pin-input-z" role="textbox" contenteditable="true" .innerText="${IInputPinTemplate.stringFromUEToInput(
Utility.minDecimals(
this.element.entity.getDefaultValue().Z
)
)}"></span>
<span class="ueb-pin-input-content ueb-pin-input-z" role="textbox" contenteditable="true" .innerText="${IInputPinTemplate
.stringFromUEToInput(Utility.minDecimals(this.element.entity.getDefaultValue().Z))
}"></span>
</div>
</div>
`