@dra2020/baseclient 1.0.115 → 1.0.117

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.
@@ -94,8 +94,9 @@ export class OTClientEngine extends OTE.OTEngine
94
94
  if (b != this.bReadOnly)
95
95
  {
96
96
  this.bReadOnly = b;
97
- if (this.bReadOnly)
98
- this.failbackToServerState();
97
+ //No longer necessary - especially since we want to allow local edits to be applied for temporary work.
98
+ //if (this.bReadOnly)
99
+ // this.failbackToServerState();
99
100
  }
100
101
  }
101
102
 
@@ -307,7 +308,10 @@ export class OTClientEngine extends OTE.OTEngine
307
308
  //
308
309
  addLocalEdit(orig: OTC.OTCompositeResource): void
309
310
  {
310
- if (! this.bReadOnly)
311
+ //Comment out bReadOnly test to now allow changes to be locally applied for readonly sessions, for playing around.
312
+ //Server still prevents any edits from actually being applied. And clientsession changes
313
+ //Don't actually send edits as well.
314
+ //if (! this.bReadOnly)
311
315
  {
312
316
  try
313
317
  {
@@ -357,6 +357,24 @@ export function featurePack(f: any, prepack?: PolyPack): any
357
357
  }
358
358
  else if (f && f.type === 'FeatureCollection' && f.features)
359
359
  {
360
+ // Empty?
361
+ if (f.features.length == 0) return f;
362
+
363
+ // Already packed or packed incorrectly?
364
+ let ff: any = f.features[0];
365
+ if (ff && ff.geometry && ff.geometry.packed)
366
+ {
367
+ // Already packed
368
+ if (ArrayBuffer.isView(ff.geometry.packed.buffer))
369
+ return f;
370
+ // Improperly packed (buffer converted to object - convert back to buffer
371
+ let o: any = ff.geometry.packed.buffer;
372
+ let b = new Float64Array(Util.countKeys(o));
373
+ for (const i in o) b[Number(i)] = o[i];
374
+ f.features.forEach((ff: any) => ff.geometry.packed.buffer = b);
375
+ return f;
376
+ }
377
+
360
378
  // Allocate one large buffer
361
379
  let nFloats: number = 0;
362
380
  let i: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dra2020/baseclient",
3
- "version": "1.0.115",
3
+ "version": "1.0.117",
4
4
  "description": "Utility functions for Javascript projects.",
5
5
  "main": "dist/baseclient.js",
6
6
  "types": "./dist/all/all.d.ts",