@focusbc/bbs-lib 0.0.7 → 0.0.10

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.
@@ -78704,8 +78704,9 @@ var MapOverlay = class _MapOverlay {
78704
78704
  dataTransfer: event.dataTransfer
78705
78705
  });
78706
78706
  };
78707
- const { zoom, heading, tilt } = options;
78708
- const { center: center3, defaultLevelId, rotation } = context;
78707
+ const { zoom, heading: optionsHeading, tilt } = options;
78708
+ const { center: center3, defaultLevelId, heading: contextHeading } = context;
78709
+ const heading = _MapOverlay.convertHeading(optionsHeading ?? contextHeading);
78709
78710
  this._context = context;
78710
78711
  this._htmlElement = htmlElement;
78711
78712
  this._levelId = defaultLevelId;
@@ -78713,7 +78714,7 @@ var MapOverlay = class _MapOverlay {
78713
78714
  zoom: zoom ?? DEFAULT_ZOOM,
78714
78715
  latitude: center3?.lat ?? 0,
78715
78716
  longitude: center3?.lng ?? 0,
78716
- bearing: (heading || rotation) ?? 0,
78717
+ bearing: heading,
78717
78718
  pitch: tilt ?? 0,
78718
78719
  maxZoom: MAX_ZOOM
78719
78720
  };
@@ -78835,7 +78836,7 @@ var MapOverlay = class _MapOverlay {
78835
78836
  this.rebuildLayers();
78836
78837
  }
78837
78838
  }
78838
- normalizeShapeInstance(shape) {
78839
+ static normalizeShapeInstance(shape) {
78839
78840
  const DEFAULT_WIDTH_METERS2 = 6;
78840
78841
  const type = shape.type;
78841
78842
  const widthMeters = type.widthInMeters != null && type.widthInMeters > 0 ? type.widthInMeters : DEFAULT_WIDTH_METERS2;
@@ -78855,6 +78856,10 @@ var MapOverlay = class _MapOverlay {
78855
78856
  rotationRadians: RotationUtils.normalizeRadians(shape.rotationRadians ?? 0)
78856
78857
  };
78857
78858
  }
78859
+ static convertHeading(heading) {
78860
+ heading = heading % 360;
78861
+ return (360 - heading) % 360;
78862
+ }
78858
78863
  //#endregion
78859
78864
  //#region Public methods
78860
78865
  /**
@@ -78875,14 +78880,14 @@ var MapOverlay = class _MapOverlay {
78875
78880
  }
78876
78881
  //#region Getters and Setters
78877
78882
  setContext(context) {
78878
- const { center: center3, defaultLevelId, rotation } = context;
78883
+ const { center: center3, defaultLevelId, heading } = context;
78879
78884
  this._context = context;
78880
78885
  this._levelId = defaultLevelId;
78881
78886
  this._viewState = {
78882
78887
  ...this._viewState,
78883
78888
  latitude: center3.lat ?? 0,
78884
78889
  longitude: center3.lng ?? 0,
78885
- bearing: rotation ?? this._viewState.bearing ?? 0
78890
+ bearing: _MapOverlay.convertHeading(heading)
78886
78891
  };
78887
78892
  this._deck.setProps({ viewState: this._viewState });
78888
78893
  this.rebuildLayers();
@@ -78944,17 +78949,17 @@ var MapOverlay = class _MapOverlay {
78944
78949
  this._centerChangedEvent.emit(center3);
78945
78950
  }
78946
78951
  getHeading() {
78947
- return this._viewState.bearing ?? 0;
78952
+ return _MapOverlay.convertHeading(this._viewState.bearing ?? 0);
78948
78953
  }
78949
78954
  setHeading(heading) {
78950
- this.applyViewState({ ...this._viewState, bearing: heading });
78955
+ this.applyViewState({ ...this._viewState, bearing: _MapOverlay.convertHeading(heading) });
78951
78956
  this._headingChangedEvent.emit(heading);
78952
78957
  }
78953
78958
  getShapes() {
78954
78959
  return this._shapes;
78955
78960
  }
78956
78961
  setShapes(shapes) {
78957
- this._shapes = shapes.map((shape) => this.normalizeShapeInstance(shape));
78962
+ this._shapes = shapes.map((shape) => _MapOverlay.normalizeShapeInstance(shape));
78958
78963
  if (this._selectedShapeId && !this._shapes.some((s2) => s2.id === this._selectedShapeId)) {
78959
78964
  this._selectedShapeId = null;
78960
78965
  }