import { html } from "lit"
import IInputPinTemplate from "./IInputPinTemplate"
import INumericPinTemplate from "./INumericPinTemplate"
import Utility from "../../Utility"
import Vector2DEntity from "../../entity/Vector2DEntity"
/** @typedef {import("../../entity/LinearColorEntity").default} LinearColorEntity */
/**
* @extends INumericPinTemplate
*/
export default class VectorInputPinTemplate extends INumericPinTemplate {
#getX() {
return IInputPinTemplate.stringFromUEToInput(Utility.minDecimals(this.element.getDefaultValue()?.X ?? 0))
}
#getY() {
return IInputPinTemplate.stringFromUEToInput(Utility.minDecimals(this.element.getDefaultValue()?.Y ?? 0))
}
/**
* @param {Number[]} values
* @param {String[]} rawValues
*/
setDefaultValue(values, rawValues) {
const vector = this.element.getDefaultValue(true)
if (!(vector instanceof Vector2DEntity)) {
throw new TypeError("Expected DefaultValue to be a Vector2DEntity")
}
vector.X = values[0]
vector.Y = values[1]
this.element.requestUpdate("DefaultValue", vector)
}
renderInput() {
return html`
`
}
}