mirror of
https://github.com/xibyte/jsketcher
synced 2025-12-06 16:33:15 +01:00
prefer-const rule for JS / manual fixes
This commit is contained in:
parent
f2369a5689
commit
ecb5e45cd3
6 changed files with 21 additions and 19 deletions
|
|
@ -53,21 +53,20 @@ export function CADTrackballControls( object, domElement ) {
|
|||
|
||||
let _state = STATE.NONE,
|
||||
_prevState = STATE.NONE,
|
||||
_lastAngle = 0,
|
||||
_touchZoomDistanceStart = 0,
|
||||
_touchZoomDistanceEnd = 0;
|
||||
|
||||
_eye = new THREE.Vector3(),
|
||||
const _eye = new THREE.Vector3(),
|
||||
|
||||
_movePrev = new THREE.Vector2(),
|
||||
_moveCurr = new THREE.Vector2(),
|
||||
|
||||
_lastAxis = new THREE.Vector3(),
|
||||
_lastAngle = 0,
|
||||
|
||||
_zoomStart = new THREE.Vector2(),
|
||||
_zoomEnd = new THREE.Vector2(),
|
||||
|
||||
_touchZoomDistanceStart = 0,
|
||||
_touchZoomDistanceEnd = 0,
|
||||
|
||||
_panStart = new THREE.Vector2(),
|
||||
_panEnd = new THREE.Vector2();
|
||||
|
||||
|
|
@ -154,13 +153,14 @@ export function CADTrackballControls( object, domElement ) {
|
|||
|
||||
this.rotateCamera = ( function() {
|
||||
|
||||
let axis = new THREE.Vector3(),
|
||||
const axis = new THREE.Vector3(),
|
||||
quaternion = new THREE.Quaternion(),
|
||||
eyeDirection = new THREE.Vector3(),
|
||||
objectUpDirection = new THREE.Vector3(),
|
||||
objectSidewaysDirection = new THREE.Vector3(),
|
||||
moveDirection = new THREE.Vector3(),
|
||||
angle;
|
||||
moveDirection = new THREE.Vector3();
|
||||
|
||||
let angle;
|
||||
|
||||
return function rotateCamera() {
|
||||
|
||||
|
|
|
|||
|
|
@ -63,9 +63,8 @@ export class MeshArrow extends Object3D {
|
|||
this.quaternion.set(1, 0, 0, 0);
|
||||
} else {
|
||||
const axis = new Vector3();
|
||||
let radians;
|
||||
axis.set(dir.z, 0, -dir.x).normalize();
|
||||
radians = Math.acos(dir.y);
|
||||
const radians = Math.acos(dir.y);
|
||||
this.quaternion.setFromAxisAngle(axis, radians);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -355,7 +355,8 @@ export function Sketch() {
|
|||
}
|
||||
|
||||
export function iteratePath(path, shift, callback) {
|
||||
let p, q, n = path.length;
|
||||
let p, q;
|
||||
const n = path.length;
|
||||
for (p = n - 1,q = 0;q < n; p = q++) {
|
||||
const ai = (p + shift) % n;
|
||||
const bi = (q + shift) % n;
|
||||
|
|
|
|||
|
|
@ -80,7 +80,8 @@ export function polygonsToSegments(polygons) {
|
|||
for (let pi = 0; pi < polygons.length; pi++) {
|
||||
const segments = [];
|
||||
const poly = polygons[pi];
|
||||
let p, q, n = poly.vertices.length;
|
||||
let p, q;
|
||||
const n = poly.vertices.length;
|
||||
for(p = n - 1, q = 0; q < n; p = q ++) {
|
||||
const a = poly.vertices[p];
|
||||
const b = poly.vertices[q];
|
||||
|
|
@ -105,7 +106,8 @@ export function reconstructSketchBounds(csg, face, strict) {
|
|||
}
|
||||
continue;
|
||||
}
|
||||
let p, q, n = poly.vertices.length;
|
||||
let p, q;
|
||||
const n = poly.vertices.length;
|
||||
for(p = n - 1, q = 0; q < n; p = q ++) {
|
||||
const a = poly.vertices[p];
|
||||
const b = poly.vertices[q];
|
||||
|
|
|
|||
|
|
@ -221,7 +221,8 @@ export function SketcherTerminal() {
|
|||
}
|
||||
|
||||
function sharedStartOfSortedArray(array) {
|
||||
let a1 = array[0], a2 = array[array.length - 1], L = a1.length, i = 0;
|
||||
const a1 = array[0], a2 = array[array.length - 1], L = a1.length;
|
||||
let i = 0;
|
||||
while (i < L && a1.charAt(i) === a2.charAt(i)) i++;
|
||||
return a1.substring(0, i);
|
||||
}
|
||||
|
|
@ -112,11 +112,10 @@ export class LinearDimension extends Dimension {
|
|||
|
||||
this.unscale = scale;
|
||||
|
||||
let a, b, startA, startB;
|
||||
a = this.getB();
|
||||
b = this.getA();
|
||||
startA = this.b;
|
||||
startB = this.a;
|
||||
const a = this.getB();
|
||||
const b = this.getA();
|
||||
const startA = this.b;
|
||||
const startB = this.a;
|
||||
|
||||
const d = distanceAB(a, b);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue