Commit Graph
2 Commits
Author SHA1 Message Date
Brian Helba c5ad886d7c Ensure that OverviewMap respects the initial rotation of attached Maps 2019-11-18 05:33:28 -05:00
Brian Helba d90a4569da Allow View.adjust* methods to take a null opt_anchor
The methods `View.adjustRotation`, `View.adjustZoom` and `View.adjustResolution`
optionally take an `opt_anchor` parameter. When `opt_anchor` is `undefined`, the
methods work properly. When it is `null`, they currently attempt to access the
`null` value as though it is a `Coordinate` object, and throw:
```
TypeError: Cannot read property '0' of null
```

This change allows `opt_anchor` to safely be `null`.

Existing code paths already expect this to be supported. For example, when
`MouseWheelZoom.useAnchor_` is `false`, then
[`MouseWheelZoom.lastAnchor_` remains `null`](https://github.com/openlayers/openlayers/blob/77bc6897dd4f4dd47d7f6d4dc34fb9d4c5a34a29/src/ol/interaction/MouseWheelZoom.js#L166);
thus, this `null` value
[is passed to `View.adjustZoom` as `opt_anchor`](https://github.com/openlayers/openlayers/blob/77bc6897dd4f4dd47d7f6d4dc34fb9d4c5a34a29/src/ol/interaction/MouseWheelZoom.js#L209).
2019-11-05 21:30:17 -05:00