From 351b7947195db0278c40b446626b702e4a6e96ad Mon Sep 17 00:00:00 2001 From: howard Date: Wed, 31 Mar 2021 17:11:42 -0700 Subject: [PATCH] chkpt --- src/Scene.js | 4 ++-- src/sketcher/{Sketcher.js => TwoDEnv.js} | 8 ++++---- src/sketcher/{sketchArc.js => drawArc.js} | 4 ++-- src/sketcher/drawEvents.js | 12 ++++++------ src/sketcher/{sketchLine.js => drawLine.js} | 4 ++-- 5 files changed, 16 insertions(+), 16 deletions(-) rename src/sketcher/{Sketcher.js => TwoDEnv.js} (98%) rename src/sketcher/{sketchArc.js => drawArc.js} (96%) rename src/sketcher/{sketchLine.js => drawLine.js} (92%) diff --git a/src/Scene.js b/src/Scene.js index 76f0766..88b7b45 100644 --- a/src/Scene.js +++ b/src/Scene.js @@ -5,7 +5,7 @@ import * as THREE from '../node_modules/three/src/Three'; // import { OrbitControls } from './utils/OrbitControls' import { TrackballControls } from './utils/trackball' -import { Sketcher } from './sketcher/Sketcher' +import { TwoDEnv } from './sketcher/TwoDEnv' import Stats from './utils/stats.module.js'; import { add3DPoint } from './datums' @@ -201,7 +201,7 @@ async function addSketch() { } } - const sketcher = new Sketcher(this.camera, this.canvas, this.store) + const sketcher = new TwoDEnv(this.camera, this.canvas, this.store) if (references.length == 1 && references[0].name[0] == 'd') { this.sketch.add(sketcher.sketch) diff --git a/src/sketcher/Sketcher.js b/src/sketcher/TwoDEnv.js similarity index 98% rename from src/sketcher/Sketcher.js rename to src/sketcher/TwoDEnv.js index 8297473..162b558 100644 --- a/src/sketcher/Sketcher.js +++ b/src/sketcher/TwoDEnv.js @@ -5,14 +5,14 @@ import * as THREE from '../../node_modules/three/src/Three'; import { drawOnClick1, drawOnClick2, drawPreClick2, drawClear } from './drawEvents' import { onHover, onDrag, onPick, onRelease } from '../utils/mouseEvents' import { addDimension, setCoincident } from './constraintEvents' -import { get3PtArc } from './sketchArc' +import { get3PtArc } from './drawArc' import { _vec2, _vec3, raycaster } from '../utils/static' import { replacer, reviver } from '../utils/mapJSONReplacer' -class Sketcher { +class TwoDEnv { constructor(camera, canvas, store, sketch) { @@ -352,7 +352,7 @@ const _y = new THREE.Vector3(); const _z = new THREE.Vector3(); -Object.assign(Sketcher.prototype, +Object.assign(TwoDEnv.prototype, { linkNum: { 'line': 0, @@ -370,4 +370,4 @@ Object.assign(Sketcher.prototype, -export { Sketcher } \ No newline at end of file +export { TwoDEnv } \ No newline at end of file diff --git a/src/sketcher/sketchArc.js b/src/sketcher/drawArc.js similarity index 96% rename from src/sketcher/sketchArc.js rename to src/sketcher/drawArc.js index 274b905..c15db17 100644 --- a/src/sketcher/sketchArc.js +++ b/src/sketcher/drawArc.js @@ -6,7 +6,7 @@ import {ptObj, lineObj} from '../utils/static' const n = 30 -export function sketchArc(mouseLoc) { +export function drawArc(mouseLoc) { const p1 = ptObj(mouseLoc) p1.matrixAutoUpdate = false; @@ -26,7 +26,7 @@ export function sketchArc(mouseLoc) { return [p1, p2, p3, arc] } -export function sketchArc2(mouseLoc, toPush) { +export function drawArc2(mouseLoc, toPush) { const [p1, p2, p3, arc] = toPush p2.geometry.attributes.position.set(mouseLoc); diff --git a/src/sketcher/drawEvents.js b/src/sketcher/drawEvents.js index 166a993..025ac2f 100644 --- a/src/sketcher/drawEvents.js +++ b/src/sketcher/drawEvents.js @@ -1,6 +1,6 @@ -import { sketchArc, sketchArc2 } from './sketchArc' -import { sketchLine, sketchLine2 } from './sketchLine' +import { drawArc, drawArc2 } from './drawArc' +import { drawLine, drawLine2 } from './drawLine' export function drawOnClick1(e) { if (e.buttons !== 1) return @@ -8,9 +8,9 @@ export function drawOnClick1(e) { const mouseLoc = this.getLocation(e); if (this.mode == "line") { - this.toPush = sketchLine.call(this, mouseLoc) + this.toPush = drawLine.call(this, mouseLoc) } else if (this.mode == "arc") { - this.toPush = sketchArc(mouseLoc) + this.toPush = drawArc(mouseLoc) } this.updatePoint = this.sketch.children.length @@ -31,9 +31,9 @@ export function drawPreClick2(e) { const mouseLoc = this.getLocation(e); if (this.mode == "line") { - sketchLine2(mouseLoc, this.toPush) + drawLine2(mouseLoc, this.toPush) } else if (this.mode == 'arc') { - sketchArc2(mouseLoc, this.toPush) + drawArc2(mouseLoc, this.toPush) } this.sketch.dispatchEvent({ type: 'change' }) diff --git a/src/sketcher/sketchLine.js b/src/sketcher/drawLine.js similarity index 92% rename from src/sketcher/sketchLine.js rename to src/sketcher/drawLine.js index 3c3878b..bd18c3c 100644 --- a/src/sketcher/sketchLine.js +++ b/src/sketcher/drawLine.js @@ -1,7 +1,7 @@ import * as THREE from '../../node_modules/three/src/Three'; import {ptObj, lineObj} from '../utils/static' -export function sketchLine(mouseLoc) { +export function drawLine(mouseLoc) { const p1 = ptObj() @@ -40,7 +40,7 @@ export function sketchLine(mouseLoc) { return [p1, p2, line]; } -export function sketchLine2(mouseLoc, toPush) { +export function drawLine2(mouseLoc, toPush) { const [p1, p2, line] = toPush