@duet3d/objectmodel 3.4.0-b16 → 3.4.0-b19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -43,6 +43,9 @@ class ModelObject {
43
43
  console.warn(`Model object ${key} changed but it could not be set due to missing setter`);
44
44
  }
45
45
  }
46
+ else if (process.env.NODE_ENV !== "production") {
47
+ console.warn(`Model object ${key} changed but it lacks the property descriptor`);
48
+ }
46
49
  }
47
50
  }
48
51
  else if (prop instanceof Array) {
@@ -184,7 +187,24 @@ function initObject(itemType, data) {
184
187
  for (let key in data) {
185
188
  const resultKey = result[key];
186
189
  if (isModelObject(resultKey)) {
187
- resultKey.update(data[key]);
190
+ const updatedObject = resultKey.update(data[key]);
191
+ if (resultKey !== updatedObject) {
192
+ const propDescriptor = Object.getOwnPropertyDescriptor(result, key);
193
+ if (propDescriptor !== undefined) {
194
+ if (propDescriptor.writable) {
195
+ result[key] = updatedObject;
196
+ }
197
+ else if (propDescriptor.set !== undefined) {
198
+ propDescriptor.set(updatedObject);
199
+ }
200
+ else if (process.env.NODE_ENV !== "production") {
201
+ console.warn(`Model object ${key} changed but it could not be set due to missing setter`);
202
+ }
203
+ }
204
+ else if (process.env.NODE_ENV !== "production") {
205
+ console.warn(`Model object ${key} changed but it lacks the property descriptor`);
206
+ }
207
+ }
188
208
  }
189
209
  else {
190
210
  result[key] = data[key];
@@ -9,6 +9,7 @@ class HangprinterKinematics extends KinematicsBase_1.default {
9
9
  this.anchors = [
10
10
  [0, -2000, -100],
11
11
  [2000, 1000, -100],
12
+ [-2000, 1000, -100],
12
13
  [0, 0, 3000]
13
14
  ];
14
15
  this.printRadius = 1500;
@@ -1,7 +1,7 @@
1
1
  import { IModelObject } from "../../ModelObject";
2
2
  import KinematicsBase, { KinematicsName } from "./KinematicsBase";
3
3
  export declare class Kinematics extends KinematicsBase {
4
- constructor();
4
+ constructor(name?: KinematicsName);
5
5
  update(jsonElement: any): IModelObject | null;
6
6
  }
7
7
  export default Kinematics;
@@ -22,8 +22,8 @@ const HangprinterKinematics_1 = require("./HangprinterKinematics");
22
22
  const ScaraKinematics_1 = require("./ScaraKinematics");
23
23
  const PolarKinematics_1 = require("./PolarKinematics");
24
24
  class Kinematics extends KinematicsBase_1.default {
25
- constructor() {
26
- super(KinematicsBase_1.KinematicsName.unknown);
25
+ constructor(name = KinematicsBase_1.KinematicsName.unknown) {
26
+ super(name);
27
27
  }
28
28
  update(jsonElement) {
29
29
  if (jsonElement === null) {
@@ -47,8 +47,9 @@ function getKinematics(name) {
47
47
  case KinematicsBase_1.KinematicsName.markForged:
48
48
  return new CoreKinematics_1.default(name);
49
49
  case KinematicsBase_1.KinematicsName.delta:
50
- case KinematicsBase_1.KinematicsName.rotaryDelta:
51
50
  return new DeltaKinematics_1.default(name);
51
+ case KinematicsBase_1.KinematicsName.rotaryDelta:
52
+ return new Kinematics(name);
52
53
  case KinematicsBase_1.KinematicsName.hangprinter:
53
54
  return new HangprinterKinematics_1.default();
54
55
  case KinematicsBase_1.KinematicsName.fiveBarScara:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duet3d/objectmodel",
3
- "version": "3.4.0-b16",
3
+ "version": "3.4.0-b19",
4
4
  "description": "TypeScript implementation of the Duet3D Object Model",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",