venue-js 1.0.0-2 → 1.0.0-next.1

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.
package/dist/index.mjs CHANGED
@@ -402,23 +402,33 @@ var getDataClient = (options) => {
402
402
  };
403
403
  const populator = createPopulator({ internalFindById, internalFilterByType });
404
404
  const registerObserver = (featureType, refetchInterval) => {
405
- let observer = observers.get(featureType);
406
- if (!observer) {
407
- const options2 = createDeliveryApiQueryOptions(featureType);
408
- observer = new QueryObserver(queryClient, {
409
- ...options2,
410
- refetchInterval
411
- });
412
- observers.set(featureType, observer);
413
- } else {
414
- console.warn(
415
- `An observer for featureType ${featureType} already exists, fail to register new one`
416
- );
405
+ if (observers.has(featureType)) {
406
+ console.warn(`Observer for ${featureType} already exists`);
407
+ const record = observers.get(featureType);
408
+ return record.observer;
417
409
  }
410
+ const options2 = createDeliveryApiQueryOptions(featureType);
411
+ const observer = new QueryObserver(queryClient, {
412
+ ...options2,
413
+ refetchInterval
414
+ });
415
+ const unsubscribe = observer.subscribe(() => {
416
+ console.log(`[venue-js] Listening to ${featureType} changes (interval = ${refetchInterval}ms)`);
417
+ });
418
+ observers.set(featureType, { observer, unsubscribe });
418
419
  return observer;
419
420
  };
421
+ const destroyObserver = (featureType) => {
422
+ const record = observers.get(featureType);
423
+ if (!record) return;
424
+ record.unsubscribe();
425
+ observers.delete(featureType);
426
+ };
420
427
  const destroyObservers = () => {
421
- observers.forEach((o) => o.destroy());
428
+ observers.forEach(({ observer, unsubscribe }) => {
429
+ unsubscribe();
430
+ observer.destroy();
431
+ });
422
432
  observers.clear();
423
433
  };
424
434
  const createFilterByTypeQueryOptions = (featureType, params = {}, options2 = {}) => ({
@@ -458,6 +468,7 @@ var getDataClient = (options) => {
458
468
  projectId,
459
469
  queryClient,
460
470
  registerObserver,
471
+ destroyObserver,
461
472
  destroyObservers,
462
473
  createFilterByTypeQueryOptions,
463
474
  createFindByIdQueryOptions,
@@ -3328,9 +3339,11 @@ var createSVGPathFromMarkerSymbol2 = (style) => {
3328
3339
  fill = "#000000"
3329
3340
  } = style;
3330
3341
  const scale2 = markerWidth / 24;
3342
+ const strokeWidth = 2;
3343
+ const halfStrokeWidth = 0.5 * strokeWidth;
3331
3344
  if (Array.isArray(markerPath)) {
3332
3345
  return markerPath.map(
3333
- ({ path, fill: fill2 }) => `<path d="${path}" style="transform:translate(${markerDx}px, ${markerDy}px) scale(${scale2})" fill="${fill2}"/>`
3346
+ ({ path, fill: fill2 }) => `<path d="${path}" style="transform:translate(${markerDx}px, ${markerDy}px) scale(${scale2})" fill="${fill2}" stroke="#ffffff" stroke-width="${strokeWidth}" />`
3334
3347
  );
3335
3348
  }
3336
3349
  return `<path d="${markerPath}" style="transform:translate(${markerDx}px, ${markerDy}px) scale(${scale2})" fill="${fill}" />`;
@@ -3345,7 +3358,6 @@ var createSpriteMaterialByLabelSymbol2 = (labelSymbol) => {
3345
3358
  const baseSVG = createSVGPathFromMarkerSymbol2(base);
3346
3359
  const iconSVG = icon ? createSVGPathFromMarkerSymbol2(icon) : "";
3347
3360
  const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${viewBoxDimension}" height="${viewBoxDimension}">${baseSVG}${iconSVG}</svg>`;
3348
- console.log(svg);
3349
3361
  const textureLoader = new TextureLoader3();
3350
3362
  const scaleFactor = 200 / 24;
3351
3363
  svgToDataURL(svg, scaleFactor).then((png) => {
@@ -3435,14 +3447,12 @@ var Element3DRenderer = class extends EventTarget {
3435
3447
  markerType: "path",
3436
3448
  markerPath: [
3437
3449
  {
3438
- path: "M21.75 0H0.25V21.5H8.35L11.3 24L14.2 21.5H21.75V0Z",
3450
+ path: "M20.775 1.2H1.225V20.35H8.215L11.3 22.8L14.385 20.35H20.775V1.2Z",
3439
3451
  fill: "#ff0000"
3440
3452
  }
3441
3453
  ],
3442
3454
  markerPathWidth: 24,
3443
- markerPathHeight: 24,
3444
- markerWidth: 30,
3445
- markerHeight: 30
3455
+ markerPathHeight: 24
3446
3456
  };
3447
3457
  const markerSymbol = {
3448
3458
  markerType: "path",