mirror of
https://github.com/xibyte/jsketcher
synced 2025-12-15 04:45:06 +01:00
fix dimension serialization
This commit is contained in:
parent
6a1fc614a5
commit
9a0aaf8fac
4 changed files with 10 additions and 16 deletions
|
|
@ -71,7 +71,7 @@ export function SketchObjectExplorer() {
|
|||
<span className={ls.objectIcon}><ObjectIcon object={o}/></span>
|
||||
{getObjectRole(o)}
|
||||
<span onClick={e => tweakSelection(o, e.shiftKey)}
|
||||
className={cx(ls.objectTag, o.marked && ls.selected)}>{o.simpleClassName} <span>{o.id}</span> </span>
|
||||
className={cx(ls.objectTag, o.marked && ls.selected)}>{o.simpleClassName} <span>{o.id}</span> </span>
|
||||
<span className={ls.menuButton}>...</span>
|
||||
</div>)}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -137,20 +137,22 @@ export class IO {
|
|||
}
|
||||
}
|
||||
|
||||
const index = this.viewer.createIndex();
|
||||
|
||||
for (let obj of sketch.dimensions) {
|
||||
try {
|
||||
let type = obj.type;
|
||||
let skobj = null;
|
||||
if (type === HDimension.prototype.TYPE) {
|
||||
skobj = LinearDimension.load(HDimension, obj.id, obj.data);
|
||||
skobj = LinearDimension.load(HDimension, obj.id, obj.data, index);
|
||||
} else if (type === VDimension.prototype.TYPE) {
|
||||
skobj = LinearDimension.load(VDimension, obj.id, obj.data);
|
||||
skobj = LinearDimension.load(VDimension, obj.id, obj.data, index);
|
||||
} else if (type === LinearDimension.prototype.TYPE) {
|
||||
skobj = LinearDimension.load(LinearDimension, obj.id, obj.data);
|
||||
skobj = LinearDimension.load(LinearDimension, obj.id, obj.data, index);
|
||||
} else if (type === DiameterDimension.prototype.TYPE) {
|
||||
skobj = DiameterDimension.load(obj.id, obj.data);
|
||||
skobj = DiameterDimension.load(obj.id, obj.data, index);
|
||||
} else if (type === AngleBetweenDimension.prototype.TYPE) {
|
||||
skobj = AngleBetweenDimension.load(obj.id, obj.data);
|
||||
skobj = AngleBetweenDimension.load(obj.id, obj.data, index);
|
||||
}
|
||||
if (skobj !== null) {
|
||||
this.viewer.dimLayer.add(skobj);
|
||||
|
|
@ -162,9 +164,6 @@ export class IO {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
const index = this.viewer.createIndex();
|
||||
|
||||
for (let i = 0; i < sketch.stages.length; i++) {
|
||||
let dataStage = sketch.stages[i];
|
||||
let stage = getStage(i);
|
||||
|
|
|
|||
5
web/app/sketcher/shapes/dim.d.ts
vendored
5
web/app/sketcher/shapes/dim.d.ts
vendored
|
|
@ -1,5 +0,0 @@
|
|||
import {SketchObject} from "./sketch-object";
|
||||
|
||||
export interface Dimension extends SketchObject {
|
||||
|
||||
}
|
||||
|
|
@ -412,7 +412,7 @@ export class DiameterDimension extends Dimension {
|
|||
}
|
||||
}
|
||||
|
||||
static load(constr, id, data, index) {
|
||||
static load(id, data, index) {
|
||||
const dim = new DiameterDimension(
|
||||
index[data.obj],
|
||||
id
|
||||
|
|
@ -713,7 +713,7 @@ export class AngleBetweenDimension extends Dimension {
|
|||
}
|
||||
}
|
||||
|
||||
static load(constr, id, data, index) {
|
||||
static load(id, data, index) {
|
||||
const dim = new AngleBetweenDimension(
|
||||
index[data.a],
|
||||
index[data.b],
|
||||
|
|
|
|||
Loading…
Reference in a new issue