Skip to content

Commit 098ccff

Browse files
committed
Clarify some comments
1 parent db1ea2f commit 098ccff

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

src/plots/map/layout_defaults.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,16 @@ function handleDefaults(containerIn, containerOut, coerce, opts) {
3939
handleItemDefaults: handleLayerDefaults
4040
});
4141

42-
// Explicitly assign `_fitBounds` (even when null) so `relinkPrivateKeys`
42+
// Explicitly reset `_fitBounds` to null so that `relinkPrivateKeys`
4343
// doesn't carry a stale value forward from the previous render
4444
containerOut._fitBounds = null;
4545

4646
// Fit the view to the data. Runs when no view attributes have
4747
// been set (initial render, or user cleared them) OR when they still
4848
// hold the exact values that were auto-computed last time. Skipped when
4949
// the user has explicitly opted out via `fitbounds: false`.
50+
// - `_fitBounds` contains the lon/lat coords for the geometry bounding box
51+
// - `_fitView` contains the view attributes after the MapLibre auto-fit has been completed
5052
const {
5153
_fitView: { center: fitCenter, zoom: fitZoom, bearing: fitBearing, pitch: fitPitch } = {},
5254
center,

src/plots/map/map.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,10 @@ function saveViewToLayout(self, opts) {
240240
const { center, zoom } = self.getView();
241241
opts._input.center = opts.center = center;
242242
opts._input.zoom = opts.zoom = zoom;
243-
// Use below to determine if the view is still on the fit view during supplyDefaults.
243+
// Use below to determine if the current view is still on the fit view during supplyDefaults.
244244
// Bearing and pitch aren't set by auto-fit, but a user change to either signals
245-
// they've engaged with the view and don't want it refit under them.
245+
// they've engaged with the view and don't want it refit under them. `_fitView` represents
246+
// the view attributes returned by MapLibre after the auto-fit has been completed.
246247
opts._input._fitView = {
247248
center: { ...center },
248249
zoom,

0 commit comments

Comments
 (0)