mirror of
https://github.com/xibyte/jsketcher
synced 2025-12-06 16:33:15 +01:00
no-extra-semi rule for TS / autofix
This commit is contained in:
parent
5aaee1c8ed
commit
b8d6b7c0ba
20 changed files with 115 additions and 115 deletions
|
|
@ -31,7 +31,7 @@
|
||||||
"no-empty": "off",
|
"no-empty": "off",
|
||||||
"no-fallthrough": "off",
|
"no-fallthrough": "off",
|
||||||
"@typescript-eslint/no-explicit-any": "off",
|
"@typescript-eslint/no-explicit-any": "off",
|
||||||
"@typescript-eslint/no-extra-semi": "off",
|
"@typescript-eslint/no-extra-semi": "error",
|
||||||
"@typescript-eslint/no-this-alias": "off",
|
"@typescript-eslint/no-this-alias": "off",
|
||||||
"@typescript-eslint/no-unused-vars": "off",
|
"@typescript-eslint/no-unused-vars": "off",
|
||||||
"@typescript-eslint/no-empty-function": "off",
|
"@typescript-eslint/no-empty-function": "off",
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ export class Loop extends TopoObject {
|
||||||
const first = polygon[nextIdx].minus(o);
|
const first = polygon[nextIdx].minus(o);
|
||||||
const last = o.minus(polygon[prevIdx]);
|
const last = o.minus(polygon[prevIdx]);
|
||||||
return last.cross(first).dot(surface.normal) >= 0;
|
return last.cross(first).dot(surface.normal) >= 0;
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function* enclosesGenerator(halfEdges): Generator<[HalfEdge, HalfEdge, Vertex]> {
|
export function* enclosesGenerator(halfEdges): Generator<[HalfEdge, HalfEdge, Vertex]> {
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ export class Line {
|
||||||
tessellate(resolution, from, to, path) {
|
tessellate(resolution, from, to, path) {
|
||||||
}
|
}
|
||||||
|
|
||||||
offset() {};
|
offset() {}
|
||||||
}
|
}
|
||||||
|
|
||||||
Line.prototype.isLine = true;
|
Line.prototype.isLine = true;
|
||||||
|
|
|
||||||
|
|
@ -134,7 +134,7 @@ export class BrepSurface {
|
||||||
let X = intersectNurbs(this.impl, other.impl, this.inverted !== other.inverted);
|
let X = intersectNurbs(this.impl, other.impl, this.inverted !== other.inverted);
|
||||||
// let X = surfaceIntersect(this.impl, other.impl);
|
// let X = surfaceIntersect(this.impl, other.impl);
|
||||||
return X.map(curve => new BrepCurve(curve));
|
return X.map(curve => new BrepCurve(curve));
|
||||||
};
|
}
|
||||||
|
|
||||||
invert() {
|
invert() {
|
||||||
return new BrepSurface(this.impl, !this.inverted);
|
return new BrepSurface(this.impl, !this.inverted);
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ export default class NurbsSurface implements ParametricSurface {
|
||||||
|
|
||||||
static loft(curve1, curve2): NurbsSurface {
|
static loft(curve1, curve2): NurbsSurface {
|
||||||
return new NurbsSurface(verb.geom.NurbsSurface.byLoftingCurves([curve1.impl.verb, curve2.impl.verb], 1));
|
return new NurbsSurface(verb.geom.NurbsSurface.byLoftingCurves([curve1.impl.verb, curve2.impl.verb], 1));
|
||||||
};
|
}
|
||||||
|
|
||||||
transform(tr: Matrix3x4Data): ParametricSurface {
|
transform(tr: Matrix3x4Data): ParametricSurface {
|
||||||
return new NurbsSurface(this.verb.transform(tr));
|
return new NurbsSurface(this.verb.transform(tr));
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ export class Matrix3x4 {
|
||||||
this.mzz = 1;
|
this.mzz = 1;
|
||||||
this.tz = 0;
|
this.tz = 0;
|
||||||
return this;
|
return this;
|
||||||
};
|
}
|
||||||
|
|
||||||
setBasis(basis: [Vector, Vector, Vector]): Matrix3x4 {
|
setBasis(basis: [Vector, Vector, Vector]): Matrix3x4 {
|
||||||
let b = basis;
|
let b = basis;
|
||||||
|
|
@ -52,7 +52,7 @@ export class Matrix3x4 {
|
||||||
this.mzz = b[2].z;
|
this.mzz = b[2].z;
|
||||||
this.tz = 0;
|
this.tz = 0;
|
||||||
return this;
|
return this;
|
||||||
};
|
}
|
||||||
|
|
||||||
setBasis3(basis: [Vec3, Vec3, Vec3]): Matrix3x4 {
|
setBasis3(basis: [Vec3, Vec3, Vec3]): Matrix3x4 {
|
||||||
const b = basis;
|
const b = basis;
|
||||||
|
|
@ -69,7 +69,7 @@ export class Matrix3x4 {
|
||||||
this.mzz = b[2][2];
|
this.mzz = b[2][2];
|
||||||
this.tz = 0;
|
this.tz = 0;
|
||||||
return this;
|
return this;
|
||||||
};
|
}
|
||||||
|
|
||||||
setBasisAxises(x: Vector, y: Vector, z: Vector): Matrix3x4 {
|
setBasisAxises(x: Vector, y: Vector, z: Vector): Matrix3x4 {
|
||||||
this.mxx = x.x;
|
this.mxx = x.x;
|
||||||
|
|
@ -85,7 +85,7 @@ export class Matrix3x4 {
|
||||||
this.mzz = z.z;
|
this.mzz = z.z;
|
||||||
this.tz = 0;
|
this.tz = 0;
|
||||||
return this;
|
return this;
|
||||||
};
|
}
|
||||||
|
|
||||||
setBasisAndTranslation(basis: [Vector, Vector, Vector], translation: Vector): Matrix3x4 {
|
setBasisAndTranslation(basis: [Vector, Vector, Vector], translation: Vector): Matrix3x4 {
|
||||||
this.setBasis(basis);
|
this.setBasis(basis);
|
||||||
|
|
@ -93,7 +93,7 @@ export class Matrix3x4 {
|
||||||
this.ty = translation.y;
|
this.ty = translation.y;
|
||||||
this.tz = translation.z;
|
this.tz = translation.z;
|
||||||
return this;
|
return this;
|
||||||
};
|
}
|
||||||
|
|
||||||
setBasisAndTranslation3(basis: [Vec3, Vec3, Vec3], translation: Vec3): Matrix3x4 {
|
setBasisAndTranslation3(basis: [Vec3, Vec3, Vec3], translation: Vec3): Matrix3x4 {
|
||||||
this.setBasis3(basis);
|
this.setBasis3(basis);
|
||||||
|
|
@ -101,7 +101,7 @@ export class Matrix3x4 {
|
||||||
this.ty = translation[1];
|
this.ty = translation[1];
|
||||||
this.tz = translation[2];
|
this.tz = translation[2];
|
||||||
return this;
|
return this;
|
||||||
};
|
}
|
||||||
|
|
||||||
getBasis3(): [Vec3, Vec3, Vec3] {
|
getBasis3(): [Vec3, Vec3, Vec3] {
|
||||||
return [
|
return [
|
||||||
|
|
@ -121,7 +121,7 @@ export class Matrix3x4 {
|
||||||
this.mzz
|
this.mzz
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
};
|
}
|
||||||
|
|
||||||
getTranslation3(): Vec3 {
|
getTranslation3(): Vec3 {
|
||||||
return [this.tx, this.ty, this.tz];
|
return [this.tx, this.ty, this.tz];
|
||||||
|
|
@ -132,21 +132,21 @@ export class Matrix3x4 {
|
||||||
this.myy *= dy;
|
this.myy *= dy;
|
||||||
this.mzz *= dz;
|
this.mzz *= dz;
|
||||||
return this;
|
return this;
|
||||||
};
|
}
|
||||||
|
|
||||||
translate(dx: number, dy: number, dz: number): Matrix3x4 {
|
translate(dx: number, dy: number, dz: number): Matrix3x4 {
|
||||||
this.tx += dx;
|
this.tx += dx;
|
||||||
this.ty += dy;
|
this.ty += dy;
|
||||||
this.tz += dz;
|
this.tz += dz;
|
||||||
return this;
|
return this;
|
||||||
};
|
}
|
||||||
|
|
||||||
translateVec({x, y, z}: Vector): Matrix3x4 {
|
translateVec({x, y, z}: Vector): Matrix3x4 {
|
||||||
this.tx += x;
|
this.tx += x;
|
||||||
this.ty += y;
|
this.ty += y;
|
||||||
this.tz += z;
|
this.tz += z;
|
||||||
return this;
|
return this;
|
||||||
};
|
}
|
||||||
|
|
||||||
set3x3(
|
set3x3(
|
||||||
mxx: number, mxy: number, mxz: number,
|
mxx: number, mxy: number, mxz: number,
|
||||||
|
|
@ -163,7 +163,7 @@ export class Matrix3x4 {
|
||||||
this.mzy = mzy;
|
this.mzy = mzy;
|
||||||
this.mzz = mzz;
|
this.mzz = mzz;
|
||||||
return this;
|
return this;
|
||||||
};
|
}
|
||||||
|
|
||||||
set3x4(
|
set3x4(
|
||||||
mxx: number, mxy: number, mxz: number, tx: number,
|
mxx: number, mxy: number, mxz: number, tx: number,
|
||||||
|
|
@ -183,7 +183,7 @@ export class Matrix3x4 {
|
||||||
this.mzz = mzz;
|
this.mzz = mzz;
|
||||||
this.tz = tz;
|
this.tz = tz;
|
||||||
return this;
|
return this;
|
||||||
};
|
}
|
||||||
|
|
||||||
setMatrix(m: Matrix3x4): Matrix3x4 {
|
setMatrix(m: Matrix3x4): Matrix3x4 {
|
||||||
this.mxx = m.mxx;
|
this.mxx = m.mxx;
|
||||||
|
|
@ -199,7 +199,7 @@ export class Matrix3x4 {
|
||||||
this.mzz = m.mzz;
|
this.mzz = m.mzz;
|
||||||
this.tz = m.tz;
|
this.tz = m.tz;
|
||||||
return this;
|
return this;
|
||||||
};
|
}
|
||||||
|
|
||||||
setToMatrix4x4(m: any): void {
|
setToMatrix4x4(m: any): void {
|
||||||
m.set(
|
m.set(
|
||||||
|
|
@ -208,7 +208,7 @@ export class Matrix3x4 {
|
||||||
this.mzx, this.mzy, this.mzz, this.tz,
|
this.mzx, this.mzy, this.mzz, this.tz,
|
||||||
0, 0, 0, 1
|
0, 0, 0, 1
|
||||||
);
|
);
|
||||||
};
|
}
|
||||||
|
|
||||||
toArray(): Matrix3x4Data {
|
toArray(): Matrix3x4Data {
|
||||||
return [
|
return [
|
||||||
|
|
@ -216,7 +216,7 @@ export class Matrix3x4 {
|
||||||
[this.myx, this.myy, this.myz, this.ty],
|
[this.myx, this.myy, this.myz, this.ty],
|
||||||
[this.mzx, this.mzy, this.mzz, this.tz]
|
[this.mzx, this.mzy, this.mzz, this.tz]
|
||||||
];
|
];
|
||||||
};
|
}
|
||||||
|
|
||||||
toFlatArray(): Matrix3x4FlatData {
|
toFlatArray(): Matrix3x4FlatData {
|
||||||
return [
|
return [
|
||||||
|
|
@ -224,23 +224,23 @@ export class Matrix3x4 {
|
||||||
this.myx, this.myy, this.myz, this.ty,
|
this.myx, this.myy, this.myz, this.ty,
|
||||||
this.mzx, this.mzy, this.mzz, this.tz
|
this.mzx, this.mzy, this.mzz, this.tz
|
||||||
];
|
];
|
||||||
};
|
}
|
||||||
|
|
||||||
invert(): Matrix3x4 {
|
invert(): Matrix3x4 {
|
||||||
return this.__invert(new Matrix3x4());
|
return this.__invert(new Matrix3x4());
|
||||||
};
|
}
|
||||||
|
|
||||||
_invert(): Matrix3x4 {
|
_invert(): Matrix3x4 {
|
||||||
return this.__invert(this);
|
return this.__invert(this);
|
||||||
};
|
}
|
||||||
|
|
||||||
normalize(): Matrix3x4 {
|
normalize(): Matrix3x4 {
|
||||||
return this.__normalize(new Matrix3x4());
|
return this.__normalize(new Matrix3x4());
|
||||||
};
|
}
|
||||||
|
|
||||||
_normalize(): Matrix3x4 {
|
_normalize(): Matrix3x4 {
|
||||||
return this.__normalize(this);
|
return this.__normalize(this);
|
||||||
};
|
}
|
||||||
|
|
||||||
__normalize(out: Matrix3x4): Matrix3x4 {
|
__normalize(out: Matrix3x4): Matrix3x4 {
|
||||||
const basis = this.getBasis3();
|
const basis = this.getBasis3();
|
||||||
|
|
@ -250,7 +250,7 @@ export class Matrix3x4 {
|
||||||
out.setBasisAndTranslation3(basis, tr);
|
out.setBasisAndTranslation3(basis, tr);
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
};
|
}
|
||||||
|
|
||||||
__invert(out: Matrix3x4): Matrix3x4 {
|
__invert(out: Matrix3x4): Matrix3x4 {
|
||||||
|
|
||||||
|
|
@ -295,7 +295,7 @@ export class Matrix3x4 {
|
||||||
out.mzz = czz / det;
|
out.mzz = czz / det;
|
||||||
out.tz = czt / det;
|
out.tz = czt / det;
|
||||||
return out;
|
return out;
|
||||||
};
|
}
|
||||||
|
|
||||||
combine(transform: Matrix3x4, out?: Matrix3x4): Matrix3x4 {
|
combine(transform: Matrix3x4, out?: Matrix3x4): Matrix3x4 {
|
||||||
let txx = transform.mxx;
|
let txx = transform.mxx;
|
||||||
|
|
@ -326,7 +326,7 @@ export class Matrix3x4 {
|
||||||
m.tz = (this.mzx * ttx + this.mzy * tty + this.mzz * ttz + this.tz);
|
m.tz = (this.mzx * ttx + this.mzy * tty + this.mzz * ttz + this.tz);
|
||||||
|
|
||||||
return m;
|
return m;
|
||||||
};
|
}
|
||||||
|
|
||||||
combine3x3(transform: Matrix3x4, out?: Matrix3x4): Matrix3x4 {
|
combine3x3(transform: Matrix3x4, out?: Matrix3x4): Matrix3x4 {
|
||||||
let txx = transform.mxx;
|
let txx = transform.mxx;
|
||||||
|
|
@ -357,7 +357,7 @@ export class Matrix3x4 {
|
||||||
|
|
||||||
|
|
||||||
return m;
|
return m;
|
||||||
};
|
}
|
||||||
|
|
||||||
__applyNoTranslation(vector: Vector, out: Vector): Vector;
|
__applyNoTranslation(vector: Vector, out: Vector): Vector;
|
||||||
__applyNoTranslation(vector: UnitVector, out: UnitVector): UnitVector;
|
__applyNoTranslation(vector: UnitVector, out: UnitVector): UnitVector;
|
||||||
|
|
@ -369,13 +369,13 @@ export class Matrix3x4 {
|
||||||
out.y = this.myx * x + this.myy * y + this.myz * z;
|
out.y = this.myx * x + this.myy * y + this.myz * z;
|
||||||
out.z = this.mzx * x + this.mzy * y + this.mzz * z;
|
out.z = this.mzx * x + this.mzy * y + this.mzz * z;
|
||||||
return out;
|
return out;
|
||||||
};
|
}
|
||||||
|
|
||||||
_applyNoTranslation(vector: Vector): Vector;
|
_applyNoTranslation(vector: Vector): Vector;
|
||||||
_applyNoTranslation(vector: UnitVector): UnitVector;
|
_applyNoTranslation(vector: UnitVector): UnitVector;
|
||||||
_applyNoTranslation(vector: Vector): Vector {
|
_applyNoTranslation(vector: Vector): Vector {
|
||||||
return this.__applyNoTranslation(vector, vector);
|
return this.__applyNoTranslation(vector, vector);
|
||||||
};
|
}
|
||||||
|
|
||||||
applyNoTranslation: {
|
applyNoTranslation: {
|
||||||
(vector: UnitVector): UnitVector;
|
(vector: UnitVector): UnitVector;
|
||||||
|
|
@ -384,7 +384,7 @@ export class Matrix3x4 {
|
||||||
|
|
||||||
_apply(vector: Vector): Vector {
|
_apply(vector: Vector): Vector {
|
||||||
return this.__apply(vector, vector);
|
return this.__apply(vector, vector);
|
||||||
};
|
}
|
||||||
|
|
||||||
__apply(vector: Vector, out: Vector): Vector {
|
__apply(vector: Vector, out: Vector): Vector {
|
||||||
let x = vector.x;
|
let x = vector.x;
|
||||||
|
|
@ -394,22 +394,22 @@ export class Matrix3x4 {
|
||||||
out.y = this.myx * x + this.myy * y + this.myz * z + this.ty;
|
out.y = this.myx * x + this.myy * y + this.myz * z + this.ty;
|
||||||
out.z = this.mzx * x + this.mzy * y + this.mzz * z + this.tz;
|
out.z = this.mzx * x + this.mzy * y + this.mzz * z + this.tz;
|
||||||
return out;
|
return out;
|
||||||
};
|
}
|
||||||
|
|
||||||
apply3(data: Vec3): Vec3 {
|
apply3(data: Vec3): Vec3 {
|
||||||
return this.__apply3(data, [0, 0, 0])
|
return this.__apply3(data, [0, 0, 0])
|
||||||
};
|
}
|
||||||
|
|
||||||
_apply3(data: Vec3): Vec3 {
|
_apply3(data: Vec3): Vec3 {
|
||||||
return this.__apply3(data, data);
|
return this.__apply3(data, data);
|
||||||
};
|
}
|
||||||
|
|
||||||
__apply3([x, y, z]: Vec3, out: Vec3): Vec3 {
|
__apply3([x, y, z]: Vec3, out: Vec3): Vec3 {
|
||||||
out[0] = this.mxx * x + this.mxy * y + this.mxz * z + this.tx;
|
out[0] = this.mxx * x + this.mxy * y + this.mxz * z + this.tx;
|
||||||
out[1] = this.myx * x + this.myy * y + this.myz * z + this.ty;
|
out[1] = this.myx * x + this.myy * y + this.myz * z + this.ty;
|
||||||
out[2] = this.mzx * x + this.mzy * y + this.mzz * z + this.tz;
|
out[2] = this.mzx * x + this.mzy * y + this.mzz * z + this.tz;
|
||||||
return out;
|
return out;
|
||||||
};
|
}
|
||||||
|
|
||||||
rotateWithSphericalAxis(axisAzimuth: number, axisInclination: number, angle: number, pivot: Vector) {
|
rotateWithSphericalAxis(axisAzimuth: number, axisInclination: number, angle: number, pivot: Vector) {
|
||||||
|
|
||||||
|
|
@ -420,11 +420,11 @@ export class Matrix3x4 {
|
||||||
);
|
);
|
||||||
|
|
||||||
return Matrix3x4.rotateMatrix(angle, axis, pivot, this);
|
return Matrix3x4.rotateMatrix(angle, axis, pivot, this);
|
||||||
};
|
}
|
||||||
|
|
||||||
rotate(angle: number, axis: Vector, pivot: Vector) {
|
rotate(angle: number, axis: Vector, pivot: Vector) {
|
||||||
return Matrix3x4.rotateMatrix(angle, axis, pivot, this);
|
return Matrix3x4.rotateMatrix(angle, axis, pivot, this);
|
||||||
};
|
}
|
||||||
|
|
||||||
static rotateMatrix(angle: number, axis: Vector, pivot: Vector, matrix?: Matrix3x4): Matrix3x4 {
|
static rotateMatrix(angle: number, axis: Vector, pivot: Vector, matrix?: Matrix3x4): Matrix3x4 {
|
||||||
const sin = Math.sin(angle);
|
const sin = Math.sin(angle);
|
||||||
|
|
@ -484,7 +484,7 @@ export class Matrix3x4 {
|
||||||
m.mzz = cos + axisZ * axisZ * (1 - cos);
|
m.mzz = cos + axisZ * axisZ * (1 - cos);
|
||||||
m.tz = pz * (1 - m.mzz) - px * m.mzx - py * m.mzy;
|
m.tz = pz * (1 - m.mzz) - px * m.mzx - py * m.mzy;
|
||||||
return m;
|
return m;
|
||||||
};
|
}
|
||||||
|
|
||||||
apply: VectorTransformer = vector => this.__apply(vector, new Vector());
|
apply: VectorTransformer = vector => this.__apply(vector, new Vector());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ export default class Vector implements XYZ {
|
||||||
|
|
||||||
length(): number {
|
length(): number {
|
||||||
return Math.sqrt(this.x*this.x + this.y*this.y + this.z*this.z);
|
return Math.sqrt(this.x*this.x + this.y*this.y + this.z*this.z);
|
||||||
};
|
}
|
||||||
|
|
||||||
lengthSquared(): number {
|
lengthSquared(): number {
|
||||||
return this.dot(this);
|
return this.dot(this);
|
||||||
|
|
@ -134,7 +134,7 @@ export default class Vector implements XYZ {
|
||||||
return this.set(0, 0, 0) as UnitVector;
|
return this.set(0, 0, 0) as UnitVector;
|
||||||
}
|
}
|
||||||
return this.set(this.x / mag, this.y / mag, this.z / mag) as UnitVector;
|
return this.set(this.x / mag, this.y / mag, this.z / mag) as UnitVector;
|
||||||
};
|
}
|
||||||
|
|
||||||
_unit(): UnitVector {
|
_unit(): UnitVector {
|
||||||
return this._normalize();
|
return this._normalize();
|
||||||
|
|
@ -142,7 +142,7 @@ export default class Vector implements XYZ {
|
||||||
|
|
||||||
cross(a: XYZ): Vector {
|
cross(a: XYZ): Vector {
|
||||||
return this.copy()._cross(a);
|
return this.copy()._cross(a);
|
||||||
};
|
}
|
||||||
|
|
||||||
_cross(a: XYZ): Vector {
|
_cross(a: XYZ): Vector {
|
||||||
return this.set(
|
return this.set(
|
||||||
|
|
@ -150,7 +150,7 @@ export default class Vector implements XYZ {
|
||||||
this.z * a.x - this.x * a.z,
|
this.z * a.x - this.x * a.z,
|
||||||
this.x * a.y - this.y * a.x
|
this.x * a.y - this.y * a.x
|
||||||
);
|
);
|
||||||
};
|
}
|
||||||
|
|
||||||
negate(): Vector {
|
negate(): Vector {
|
||||||
return this.multiply(-1);
|
return this.multiply(-1);
|
||||||
|
|
|
||||||
|
|
@ -273,14 +273,14 @@ export default class SceneSetUp {
|
||||||
this.__render_NeverCallMeFromOutside();
|
this.__render_NeverCallMeFromOutside();
|
||||||
}
|
}
|
||||||
this.updateViewportSizeIfNeeded();
|
this.updateViewportSizeIfNeeded();
|
||||||
};
|
}
|
||||||
|
|
||||||
private __render_NeverCallMeFromOutside() {
|
private __render_NeverCallMeFromOutside() {
|
||||||
this.renderRequested = false;
|
this.renderRequested = false;
|
||||||
this.light.position.set(this.camera.position.x, this.camera.position.y, this.camera.position.z);
|
this.light.position.set(this.camera.position.x, this.camera.position.y, this.camera.position.z);
|
||||||
this.renderer.render(this.scene, this.camera);
|
this.renderer.render(this.scene, this.camera);
|
||||||
this.sceneRendered$.next();
|
this.sceneRendered$.next();
|
||||||
};
|
}
|
||||||
|
|
||||||
domElement() {
|
domElement() {
|
||||||
return this.renderer.domElement;
|
return this.renderer.domElement;
|
||||||
|
|
|
||||||
|
|
@ -236,7 +236,7 @@ export class ResizeHelper {
|
||||||
document.addEventListener("mousemove", moveListener);
|
document.addEventListener("mousemove", moveListener);
|
||||||
document.addEventListener("mouseup", quitListener);
|
document.addEventListener("mouseup", quitListener);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
|
|
||||||
registerResize (el, dirMask, capturingBuffer = 5, onResize = NOOP) {
|
registerResize (el, dirMask, capturingBuffer = 5, onResize = NOOP) {
|
||||||
|
|
@ -307,7 +307,7 @@ export class ResizeHelper {
|
||||||
el.style.cursor = '';
|
el.style.cursor = '';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const DIRECTIONS = {
|
export const DIRECTIONS = {
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ export class MDatumAxis extends MObject {
|
||||||
|
|
||||||
toDirection(): UnitVector {
|
toDirection(): UnitVector {
|
||||||
return this.dir;
|
return this.dir;
|
||||||
};
|
}
|
||||||
|
|
||||||
toAxis(reverse: boolean): Axis {
|
toAxis(reverse: boolean): Axis {
|
||||||
let axis = this.axis;
|
let axis = this.axis;
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ export class MEdge extends MObject {
|
||||||
|
|
||||||
toDirection(): UnitVector {
|
toDirection(): UnitVector {
|
||||||
return this.brepEdge.halfEdge1.tangentAtStart();
|
return this.brepEdge.halfEdge1.tangentAtStart();
|
||||||
};
|
}
|
||||||
|
|
||||||
toAxis(reverse: boolean = false): Axis {
|
toAxis(reverse: boolean = false): Axis {
|
||||||
let tan;
|
let tan;
|
||||||
|
|
@ -55,7 +55,7 @@ export class MEdge extends MObject {
|
||||||
origin = he.vertexB.point;
|
origin = he.vertexB.point;
|
||||||
}
|
}
|
||||||
return new Axis(origin, tan);
|
return new Axis(origin, tan);
|
||||||
};
|
}
|
||||||
|
|
||||||
get topology(): TopoObject {
|
get topology(): TopoObject {
|
||||||
return this.brepEdge;
|
return this.brepEdge;
|
||||||
|
|
|
||||||
|
|
@ -234,7 +234,7 @@ export class MBrepFace extends MFace {
|
||||||
|
|
||||||
toDirection(): UnitVector {
|
toDirection(): UnitVector {
|
||||||
return this.normal();
|
return this.normal();
|
||||||
};
|
}
|
||||||
|
|
||||||
toAxis(reverse: boolean): Axis {
|
toAxis(reverse: boolean): Axis {
|
||||||
const dir = this.toDirection();
|
const dir = this.toDirection();
|
||||||
|
|
@ -242,6 +242,6 @@ export class MBrepFace extends MFace {
|
||||||
dir._negate();
|
dir._negate();
|
||||||
}
|
}
|
||||||
return new Axis(this.favorablePoint, dir);
|
return new Axis(this.favorablePoint, dir);
|
||||||
};
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ export abstract class MObject {
|
||||||
|
|
||||||
toDirection(): UnitVector {
|
toDirection(): UnitVector {
|
||||||
return null;
|
return null;
|
||||||
};
|
}
|
||||||
|
|
||||||
toAxis(reverse: boolean): Axis {
|
toAxis(reverse: boolean): Axis {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ export class MSketchObject extends MObject {
|
||||||
toDirection(): UnitVector {
|
toDirection(): UnitVector {
|
||||||
const tangent = (this.sketchPrimitive as Segment).tangentAtStart();
|
const tangent = (this.sketchPrimitive as Segment).tangentAtStart();
|
||||||
return this.face.sketchToWorldTransformation.applyNoTranslation(tangent)._normalize();
|
return this.face.sketchToWorldTransformation.applyNoTranslation(tangent)._normalize();
|
||||||
};
|
}
|
||||||
|
|
||||||
toAxis(reverse: boolean): Axis {
|
toAxis(reverse: boolean): Axis {
|
||||||
let seg = this.sketchPrimitive as Segment;
|
let seg = this.sketchPrimitive as Segment;
|
||||||
|
|
@ -42,6 +42,6 @@ export class MSketchObject extends MObject {
|
||||||
tan = this.face.sketchToWorldTransformation.applyNoTranslation(tan)._normalize();
|
tan = this.face.sketchToWorldTransformation.applyNoTranslation(tan)._normalize();
|
||||||
origin = this.face.sketchToWorldTransformation.apply(origin);
|
origin = this.face.sketchToWorldTransformation.apply(origin);
|
||||||
return new Axis(origin, tan);
|
return new Axis(origin, tan);
|
||||||
};
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -20,12 +20,12 @@ export class SolverParam {
|
||||||
this.set(value);
|
this.set(value);
|
||||||
this.constant = false;
|
this.constant = false;
|
||||||
this.j = -1;
|
this.j = -1;
|
||||||
};
|
}
|
||||||
|
|
||||||
set(value) {
|
set(value) {
|
||||||
if (this.constant) return;
|
if (this.constant) return;
|
||||||
this.value = value;
|
this.value = value;
|
||||||
};
|
}
|
||||||
|
|
||||||
get() {
|
get() {
|
||||||
return this.value;
|
return this.value;
|
||||||
|
|
|
||||||
|
|
@ -231,7 +231,7 @@ export class IO {
|
||||||
this.viewer.parametricManager.notify();
|
this.viewer.parametricManager.notify();
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
|
|
||||||
createBoundaryObjects(boundary) {
|
createBoundaryObjects(boundary) {
|
||||||
|
|
@ -256,7 +256,7 @@ export class IO {
|
||||||
this.viewer.parametricManager.reset();
|
this.viewer.parametricManager.reset();
|
||||||
this.viewer.parametricManager.notify();
|
this.viewer.parametricManager.notify();
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
_serializeSketch(metadata) {
|
_serializeSketch(metadata) {
|
||||||
|
|
||||||
|
|
@ -335,11 +335,11 @@ export class IO {
|
||||||
}
|
}
|
||||||
|
|
||||||
return sketch;
|
return sketch;
|
||||||
};
|
}
|
||||||
|
|
||||||
getWorkspaceToExport() {
|
getWorkspaceToExport() {
|
||||||
return [this.viewer.layers, [this.viewer.labelLayer]];
|
return [this.viewer.layers, [this.viewer.labelLayer]];
|
||||||
};
|
}
|
||||||
|
|
||||||
getLayersToExport() {
|
getLayersToExport() {
|
||||||
let ws = this.getWorkspaceToExport();
|
let ws = this.getWorkspaceToExport();
|
||||||
|
|
@ -390,7 +390,7 @@ export class IO {
|
||||||
}
|
}
|
||||||
bbox.inc(20);
|
bbox.inc(20);
|
||||||
return _format("<svg viewBox='$ $ $ $'>\n", bbox.bbox) + out.data + "</svg>"
|
return _format("<svg viewBox='$ $ $ $'>\n", bbox.bbox) + out.data + "</svg>"
|
||||||
};
|
}
|
||||||
|
|
||||||
dxfExport() {
|
dxfExport() {
|
||||||
|
|
||||||
|
|
@ -456,7 +456,7 @@ export class IO {
|
||||||
//console.log(d.toDxfString());
|
//console.log(d.toDxfString());
|
||||||
d.generateAutocadExtras();
|
d.generateAutocadExtras();
|
||||||
return d.toDxfString();
|
return d.toDxfString();
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function _format(str, args) {
|
function _format(str, args) {
|
||||||
|
|
|
||||||
|
|
@ -125,12 +125,12 @@ class ParametricManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
onConstantsExternalChange(constantDefinition) {
|
onConstantsExternalChange(constantDefinition) {
|
||||||
this.rebuildConstantTable(constantDefinition);
|
this.rebuildConstantTable(constantDefinition);
|
||||||
// this.refresh();
|
// this.refresh();
|
||||||
};
|
}
|
||||||
|
|
||||||
defineNewConstant(name, value) {
|
defineNewConstant(name, value) {
|
||||||
let constantDefinition = this.constantDefinition;
|
let constantDefinition = this.constantDefinition;
|
||||||
|
|
@ -141,19 +141,19 @@ class ParametricManager {
|
||||||
constantDefinition = constantText;
|
constantDefinition = constantText;
|
||||||
}
|
}
|
||||||
this.$constantDefinition.next(constantDefinition);
|
this.$constantDefinition.next(constantDefinition);
|
||||||
};
|
}
|
||||||
|
|
||||||
updateConstraintConstants(constr) {
|
updateConstraintConstants(constr) {
|
||||||
this.viewer.parametricManager.refresh();
|
this.viewer.parametricManager.refresh();
|
||||||
};
|
}
|
||||||
|
|
||||||
notify() {
|
notify() {
|
||||||
this.$update.next();
|
this.$update.next();
|
||||||
};
|
}
|
||||||
|
|
||||||
commit() {
|
commit() {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
};
|
}
|
||||||
|
|
||||||
_add(constr) {
|
_add(constr) {
|
||||||
|
|
||||||
|
|
@ -178,7 +178,7 @@ class ParametricManager {
|
||||||
if (highestStage !== this.stage && !this.inTransaction) {
|
if (highestStage !== this.stage && !this.inTransaction) {
|
||||||
toast("Constraint's been added to stage " + highestStage.index + "!")
|
toast("Constraint's been added to stage " + highestStage.index + "!")
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
refresh() {
|
refresh() {
|
||||||
if (this.inTransaction) {
|
if (this.inTransaction) {
|
||||||
|
|
@ -192,7 +192,7 @@ class ParametricManager {
|
||||||
this.viewer.historyManager.checkpoint();
|
this.viewer.historyManager.checkpoint();
|
||||||
this._add(constr);
|
this._add(constr);
|
||||||
this.refresh();
|
this.refresh();
|
||||||
};
|
}
|
||||||
|
|
||||||
addAll(constrs) {
|
addAll(constrs) {
|
||||||
this.viewer.historyManager.checkpoint();
|
this.viewer.historyManager.checkpoint();
|
||||||
|
|
@ -200,19 +200,19 @@ class ParametricManager {
|
||||||
this._add(constrs[i]);
|
this._add(constrs[i]);
|
||||||
}
|
}
|
||||||
this.refresh();
|
this.refresh();
|
||||||
};
|
}
|
||||||
|
|
||||||
remove(constr) {
|
remove(constr) {
|
||||||
this.viewer.historyManager.checkpoint();
|
this.viewer.historyManager.checkpoint();
|
||||||
constr.stage.algNumSystem.removeConstraint(constr);
|
constr.stage.algNumSystem.removeConstraint(constr);
|
||||||
constr.annotations.forEach(ann => ann.layer.remove(ann));
|
constr.annotations.forEach(ann => ann.layer.remove(ann));
|
||||||
this.refresh();
|
this.refresh();
|
||||||
};
|
}
|
||||||
|
|
||||||
_removeConstraint(constr) {
|
_removeConstraint(constr) {
|
||||||
constr.stage.algNumSystem.removeConstraint(constr);
|
constr.stage.algNumSystem.removeConstraint(constr);
|
||||||
constr.annotations.forEach(ann => ann.layer.remove(ann));
|
constr.annotations.forEach(ann => ann.layer.remove(ann));
|
||||||
};
|
}
|
||||||
|
|
||||||
removeGenerator(generator) {
|
removeGenerator(generator) {
|
||||||
this.viewer.deselectAll();
|
this.viewer.deselectAll();
|
||||||
|
|
@ -242,7 +242,7 @@ class ParametricManager {
|
||||||
this._removeObject(obj, force);
|
this._removeObject(obj, force);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
||||||
_removeObject = (obj, force?) => {
|
_removeObject = (obj, force?) => {
|
||||||
if (obj.__disposed) {
|
if (obj.__disposed) {
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ export abstract class SketchObject extends Shape implements SolvableObject {
|
||||||
|
|
||||||
dependsOn(obj: SketchObject): boolean {
|
dependsOn(obj: SketchObject): boolean {
|
||||||
return false;
|
return false;
|
||||||
};
|
}
|
||||||
|
|
||||||
get isGenerated() {
|
get isGenerated() {
|
||||||
let obj: SketchObject = this;
|
let obj: SketchObject = this;
|
||||||
|
|
|
||||||
|
|
@ -34,4 +34,4 @@ export default function(viewer): SketcherStreams {
|
||||||
};
|
};
|
||||||
|
|
||||||
return streams as SketcherStreams;
|
return streams as SketcherStreams;
|
||||||
};
|
}
|
||||||
|
|
@ -139,11 +139,11 @@ export class Viewer {
|
||||||
this.canvas = null;
|
this.canvas = null;
|
||||||
this.toolManager.dispose();
|
this.toolManager.dispose();
|
||||||
Generator.resetIDGenerator();
|
Generator.resetIDGenerator();
|
||||||
};
|
}
|
||||||
|
|
||||||
isDisposed() {
|
isDisposed() {
|
||||||
return this.canvas === null;
|
return this.canvas === null;
|
||||||
};
|
}
|
||||||
|
|
||||||
setTransformation(a, b, c, d, e, f, zoom) {
|
setTransformation(a, b, c, d, e, f, zoom) {
|
||||||
this.transformation = [a, b, c, d, e, f];
|
this.transformation = [a, b, c, d, e, f];
|
||||||
|
|
@ -156,30 +156,30 @@ export class Viewer {
|
||||||
b, d, 0, f,
|
b, d, 0, f,
|
||||||
0, 0, 1, 0
|
0, 0, 1, 0
|
||||||
)._invert();
|
)._invert();
|
||||||
};
|
}
|
||||||
|
|
||||||
roundToPrecision(value) {
|
roundToPrecision(value) {
|
||||||
return value.toFixed(this.presicion);
|
return value.toFixed(this.presicion);
|
||||||
};
|
}
|
||||||
|
|
||||||
addSegment(x1, y1, x2, y2, layer) {
|
addSegment(x1, y1, x2, y2, layer) {
|
||||||
const line = new Segment(x1, y1, x2, y2);
|
const line = new Segment(x1, y1, x2, y2);
|
||||||
layer.add(line);
|
layer.add(line);
|
||||||
return line;
|
return line;
|
||||||
};
|
}
|
||||||
|
|
||||||
remove(obj) {
|
remove(obj) {
|
||||||
this.removeAll([obj]);
|
this.removeAll([obj]);
|
||||||
};
|
}
|
||||||
|
|
||||||
removeAll(objects) {
|
removeAll(objects) {
|
||||||
this.deselectAll();
|
this.deselectAll();
|
||||||
this.parametricManager.removeObjects(objects);
|
this.parametricManager.removeObjects(objects);
|
||||||
};
|
}
|
||||||
|
|
||||||
add(obj, layer) {
|
add(obj, layer) {
|
||||||
layer.add(obj);
|
layer.add(obj);
|
||||||
};
|
}
|
||||||
|
|
||||||
search(x, y, buffer, deep, onlyPoints, filter) {
|
search(x, y, buffer, deep, onlyPoints, filter) {
|
||||||
|
|
||||||
|
|
@ -235,7 +235,7 @@ export class Viewer {
|
||||||
pickResult[heroIdx] = _f;
|
pickResult[heroIdx] = _f;
|
||||||
}
|
}
|
||||||
return pickResult;
|
return pickResult;
|
||||||
};
|
}
|
||||||
|
|
||||||
_createServiceLayers(): Layer<Shape>[] {
|
_createServiceLayers(): Layer<Shape>[] {
|
||||||
let layer = this.createLayer<Shape>("_service", Styles.SERVICE);
|
let layer = this.createLayer<Shape>("_service", Styles.SERVICE);
|
||||||
|
|
@ -244,7 +244,7 @@ export class Viewer {
|
||||||
layer.objects.push(this.referencePoint);
|
layer.objects.push(this.referencePoint);
|
||||||
layer.objects.push(new BasisOrigin(null, this));
|
layer.objects.push(new BasisOrigin(null, this));
|
||||||
return [layer];
|
return [layer];
|
||||||
};
|
}
|
||||||
|
|
||||||
createGroundObjects() {
|
createGroundObjects() {
|
||||||
const groundObjectsGenerator = new SketchGenerator({}, GroundObjectsGeneratorSchema);
|
const groundObjectsGenerator = new SketchGenerator({}, GroundObjectsGeneratorSchema);
|
||||||
|
|
@ -258,7 +258,7 @@ export class Viewer {
|
||||||
viewer.repaint();
|
viewer.repaint();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
||||||
repaint() {
|
repaint() {
|
||||||
|
|
||||||
|
|
@ -284,7 +284,7 @@ export class Viewer {
|
||||||
|
|
||||||
this.__drawWorkspace(ctx, this._workspace, Viewer.__SKETCH_DRAW_PIPELINE);
|
this.__drawWorkspace(ctx, this._workspace, Viewer.__SKETCH_DRAW_PIPELINE);
|
||||||
this.__drawWorkspace(ctx, this._serviceWorkspace, Viewer.__SIMPLE_DRAW_PIPELINE);
|
this.__drawWorkspace(ctx, this._serviceWorkspace, Viewer.__SIMPLE_DRAW_PIPELINE);
|
||||||
};
|
}
|
||||||
|
|
||||||
__drawWorkspace(ctx, workspace, pipeline) {
|
__drawWorkspace(ctx, workspace, pipeline) {
|
||||||
for (let drawPredicate of pipeline) {
|
for (let drawPredicate of pipeline) {
|
||||||
|
|
@ -306,7 +306,7 @@ export class Viewer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
__draw(ctx, layer, obj) {
|
__draw(ctx, layer, obj) {
|
||||||
const style = this.getStyleForObject(layer, obj);
|
const style = this.getStyleForObject(layer, obj);
|
||||||
|
|
@ -315,7 +315,7 @@ export class Viewer {
|
||||||
}
|
}
|
||||||
this.__prevStyle = style;
|
this.__prevStyle = style;
|
||||||
obj.draw(ctx, this.scale / this.retinaPxielRatio, this);
|
obj.draw(ctx, this.scale / this.retinaPxielRatio, this);
|
||||||
};
|
}
|
||||||
|
|
||||||
getStyleForObject(layer, obj) {
|
getStyleForObject(layer, obj) {
|
||||||
if (obj.style != null) {
|
if (obj.style != null) {
|
||||||
|
|
@ -327,11 +327,11 @@ export class Viewer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return layer.style;
|
return layer.style;
|
||||||
};
|
}
|
||||||
|
|
||||||
setStyle(style, ctx) {
|
setStyle(style, ctx) {
|
||||||
draw_utils.SetStyle(style, ctx, this.scale / this.retinaPxielRatio);
|
draw_utils.SetStyle(style, ctx, this.scale / this.retinaPxielRatio);
|
||||||
};
|
}
|
||||||
|
|
||||||
snap(x, y, excl) {
|
snap(x, y, excl) {
|
||||||
this.cleanSnap();
|
this.cleanSnap();
|
||||||
|
|
@ -340,11 +340,11 @@ export class Viewer {
|
||||||
this.capture('tool', [snapTo[0]], true);
|
this.capture('tool', [snapTo[0]], true);
|
||||||
}
|
}
|
||||||
return this.snapped;
|
return this.snapped;
|
||||||
};
|
}
|
||||||
|
|
||||||
cleanSnap() {
|
cleanSnap() {
|
||||||
this.withdrawAll('tool')
|
this.withdrawAll('tool')
|
||||||
};
|
}
|
||||||
|
|
||||||
showBounds(x1, y1, x2, y2) {
|
showBounds(x1, y1, x2, y2) {
|
||||||
const dx = Math.max(x2 - x1, 1);
|
const dx = Math.max(x2 - x1, 1);
|
||||||
|
|
@ -358,7 +358,7 @@ export class Viewer {
|
||||||
}
|
}
|
||||||
this.translate.x = -x1 * this.scale;
|
this.translate.x = -x1 * this.scale;
|
||||||
this.translate.y = -y1 * this.scale;
|
this.translate.y = -y1 * this.scale;
|
||||||
};
|
}
|
||||||
|
|
||||||
fit() {
|
fit() {
|
||||||
let count = 0;
|
let count = 0;
|
||||||
|
|
@ -392,17 +392,17 @@ export class Viewer {
|
||||||
out.x /= this.scale;
|
out.x /= this.scale;
|
||||||
out.y /= this.scale;
|
out.y /= this.scale;
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
screenToModel(e) {
|
screenToModel(e) {
|
||||||
return this._screenToModel(e.offsetX, e.offsetY);
|
return this._screenToModel(e.offsetX, e.offsetY);
|
||||||
};
|
}
|
||||||
|
|
||||||
_screenToModel(x, y) {
|
_screenToModel(x, y) {
|
||||||
const out = {x: 0, y: 0};
|
const out = {x: 0, y: 0};
|
||||||
this.screenToModel2(x, y, out);
|
this.screenToModel2(x, y, out);
|
||||||
return out;
|
return out;
|
||||||
};
|
}
|
||||||
|
|
||||||
screenToModelDistance(dist) {
|
screenToModelDistance(dist) {
|
||||||
measurer.x = 0;
|
measurer.x = 0;
|
||||||
|
|
@ -437,7 +437,7 @@ export class Viewer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
};
|
}
|
||||||
|
|
||||||
findById(id) {
|
findById(id) {
|
||||||
let result = null;
|
let result = null;
|
||||||
|
|
@ -449,7 +449,7 @@ export class Viewer {
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
};
|
}
|
||||||
|
|
||||||
createIndex() {
|
createIndex() {
|
||||||
const index = {};
|
const index = {};
|
||||||
|
|
@ -476,7 +476,7 @@ export class Viewer {
|
||||||
obj.addMarker(CAPTURES[type]);
|
obj.addMarker(CAPTURES[type]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
|
|
||||||
withdraw(type, obj) {
|
withdraw(type, obj) {
|
||||||
|
|
@ -487,7 +487,7 @@ export class Viewer {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
withdrawAll(type) {
|
withdrawAll(type) {
|
||||||
const captured = this.captured[type];
|
const captured = this.captured[type];
|
||||||
|
|
@ -495,22 +495,22 @@ export class Viewer {
|
||||||
captured[i].removeMarker(CAPTURES[type]);
|
captured[i].removeMarker(CAPTURES[type]);
|
||||||
}
|
}
|
||||||
while (captured.length > 0) captured.pop();
|
while (captured.length > 0) captured.pop();
|
||||||
};
|
}
|
||||||
|
|
||||||
withdrawGlobal() {
|
withdrawGlobal() {
|
||||||
Object.keys(this.captured).forEach(type => this.withdrawAll(type));
|
Object.keys(this.captured).forEach(type => this.withdrawAll(type));
|
||||||
this.streams.selection.next(this.selected);
|
this.streams.selection.next(this.selected);
|
||||||
};
|
}
|
||||||
|
|
||||||
deselect(obj) {
|
deselect(obj) {
|
||||||
this.withdraw('selection', obj);
|
this.withdraw('selection', obj);
|
||||||
this.streams.selection.next(this.selected);
|
this.streams.selection.next(this.selected);
|
||||||
};
|
}
|
||||||
|
|
||||||
deselectAll() {
|
deselectAll() {
|
||||||
this.withdrawAll('selection');
|
this.withdrawAll('selection');
|
||||||
this.streams.selection.next(this.selected);
|
this.streams.selection.next(this.selected);
|
||||||
};
|
}
|
||||||
|
|
||||||
highlight(objs, exclusive) {
|
highlight(objs, exclusive) {
|
||||||
this.capture('highlight', objs, exclusive);
|
this.capture('highlight', objs, exclusive);
|
||||||
|
|
@ -527,7 +527,7 @@ export class Viewer {
|
||||||
pick(e) {
|
pick(e) {
|
||||||
const m = this.screenToModel(e);
|
const m = this.screenToModel(e);
|
||||||
return this.search(m.x, m.y, DEFAULT_SEARCH_BUFFER, true, false, []);
|
return this.search(m.x, m.y, DEFAULT_SEARCH_BUFFER, true, false, []);
|
||||||
};
|
}
|
||||||
|
|
||||||
get activeLayer() {
|
get activeLayer() {
|
||||||
let layer = this._activeLayer;
|
let layer = this._activeLayer;
|
||||||
|
|
@ -542,7 +542,7 @@ export class Viewer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return this.findLayerByName(PREDEFINED_LAYERS.SKETCH);
|
return this.findLayerByName(PREDEFINED_LAYERS.SKETCH);
|
||||||
};
|
}
|
||||||
|
|
||||||
set activeLayerName(layerName) {
|
set activeLayerName(layerName) {
|
||||||
let layer = this.findLayerByName(layerName);
|
let layer = this.findLayerByName(layerName);
|
||||||
|
|
@ -551,22 +551,22 @@ export class Viewer {
|
||||||
} else {
|
} else {
|
||||||
console.warn("layer doesn't exist: " + layerName);
|
console.warn("layer doesn't exist: " + layerName);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
setActiveLayer(layer) {
|
setActiveLayer(layer) {
|
||||||
if (!layer.readOnly) {
|
if (!layer.readOnly) {
|
||||||
this._activeLayer = layer;
|
this._activeLayer = layer;
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
fullHeavyUIRefresh() {
|
fullHeavyUIRefresh() {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
this.parametricManager.notify();
|
this.parametricManager.notify();
|
||||||
};
|
}
|
||||||
|
|
||||||
createLayer<T>(name, style) {
|
createLayer<T>(name, style) {
|
||||||
return new Layer<T>(name, style, this)
|
return new Layer<T>(name, style, this)
|
||||||
};
|
}
|
||||||
|
|
||||||
objectsUpdate = () => this.streams.objectsUpdate.next();
|
objectsUpdate = () => this.streams.objectsUpdate.next();
|
||||||
|
|
||||||
|
|
@ -625,7 +625,7 @@ export class Layer<T = Shape> {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
};
|
}
|
||||||
|
|
||||||
add(object) {
|
add(object) {
|
||||||
if (object.layer !== undefined) {
|
if (object.layer !== undefined) {
|
||||||
|
|
@ -639,7 +639,7 @@ export class Layer<T = Shape> {
|
||||||
} else {
|
} else {
|
||||||
this._addAndNotify(object);
|
this._addAndNotify(object);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
traverseSketchObjects(callback) {
|
traverseSketchObjects(callback) {
|
||||||
this.objects.forEach(o => {
|
this.objects.forEach(o => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue