chkpt
parent
fb17612e2a
commit
351b794719
|
@ -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)
|
||||
|
|
|
@ -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 }
|
||||
export { TwoDEnv }
|
|
@ -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);
|
|
@ -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' })
|
||||
|
|
|
@ -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
|
||||
|
Loading…
Reference in New Issue