lingo3d
Version:
Lingo3D is a React/Vue 3d game development framework that ships with a complete visual editor
49 lines • 1.39 kB
JavaScript
import { Reactive } from "@lincode/reactivity";
import canvasToWorld from "../display/utils/canvasToWorld";
import { projectionNodeDefaults, projectionNodeSchema } from "../interface/IProjectionNode";
import GameGraphChild from "./GameGraphChild";
class ProjectionNode extends GameGraphChild {
static componentName = "projectionNode";
static defaults = projectionNodeDefaults;
static schema = projectionNodeSchema;
static includeKeys = ["x", "y", "distance", "outX", "outY", "outZ"];
refreshState = new Reactive({});
_x = 0;
get x() {
return this._x;
}
set x(value) {
this._x = value;
this.refreshState.set({});
}
_y = 0;
get y() {
return this._y;
}
set y(value) {
this._y = value;
this.refreshState.set({});
}
_distance = 500;
get distance() {
return this._distance;
}
set distance(value) {
this._distance = value;
this.refreshState.set({});
}
outX = 0;
outY = 0;
outZ = 0;
constructor() {
super();
this.createEffect(() => {
const pt = canvasToWorld(this._x, this._y, this._distance);
this.outX = pt.x;
this.outY = pt.y;
this.outZ = pt.z;
}, [this.refreshState.get]);
}
}
export default ProjectionNode;
//# sourceMappingURL=ProjectionNode.js.map