awv3
Version:
⚡ AWV3 embedded CAD
57 lines (44 loc) • 1.54 kB
JavaScript
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
import * as THREE from 'three';
import InfinitePlane from '../../../three/infiniteplane';
import BaseGraphics from './base';
var LinesCount = 1e3;
var Sketch =
/*#__PURE__*/
function (_BaseGraphics) {
_inheritsLoose(Sketch, _BaseGraphics);
function Sketch(session) {
var _this;
_this = _BaseGraphics.call(this) || this;
_this.session = session;
_this.day = session.globals.day;
_this.measurable = false;
_this.step = undefined;
_this.grid = undefined;
_this.axes = undefined;
_this.plane = new InfinitePlane();
_this.plane.plane.normal.set(0, 0, 1);
_this.add(_this.plane);
return _this;
}
var _proto = Sketch.prototype;
_proto.update = function update(newStep) {
if (newStep !== this.step || this.day != this.session.globals.day) {
this.day = this.session.globals.day;
this.step = newStep;
if (this.grid) {
this.remove(this.grid);
this.grid.geometry.dispose();
}
this.grid = new THREE.GridHelper(newStep * LinesCount, LinesCount, 0x9f9f9f, this.session.globals.day ? 0xcfcfcf : 0x454545);
this.grid.quaternion.setFromUnitVectors(new THREE.Vector3(0, 0, 1), new THREE.Vector3(0, 1, 0));
this.grid.interactive = false;
this.add(this.grid);
}
};
_proto.updateFromSketcherAndId = function updateFromSketcherAndId(sketcher, id) {
this.update(sketcher.gridStep);
};
return Sketch;
}(BaseGraphics);
export { Sketch as default };