Commit f2bf791
feat!: camera composition instead of inheritance (#7800)
* Use classes for all the events.
* Update changelog
* Fix comments.
* Update bundle size
* More event changes
* Update changelog
* Make evented generic to allow spcifying the event types.
* Improve imports, make evented abstract.
* Remove string from event registration.
* Remvoe dead event code.
* Fix render test typecheck.
* Fix docs generation
* Refactor: Map composes Camera instead of extending it
Major architectural change moving from inheritance to composition:
- Map now extends Evented<MapEventType> instead of Camera
- Map has a _camera property containing a Camera instance
- Camera is now a concrete class (was abstract)
- All camera-related state moved to Camera class
- Handlers initialized on Camera instance
- TransformProvider now receives Camera directly
- Dependency injection for handlers in handler constructors
This reduces coupling between Map and Camera while maintaining the same
public API. Camera is now a more self-contained component.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
* Fix: pass allowGestures parameter in Camera.stop()
The public stop() method was accepting the allowGestures parameter but not
passing it to _stop(), causing handlers to be reset when they shouldn't be.
This caused dragend and other end events to fire prematurely.
Fixes: 41 test failures in drag_pan, drag_rotate, and other handlers.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
* Restore CHANGELOG.md with complete version history
The composition refactoring commit accidentally wiped most of the CHANGELOG
content. Restored all versions from 6.0.0-7 onwards and updated the main
section with notes about the composition refactoring and Camera.stop() fix.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
* Update CHANGELOG with camera composition refactoring details
Added Camera composition feature note and Camera.stop() bugfix to main section.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
* Update chagelog
* Remove unwanted getters and setters.
* More changes to file to reduce decopling.
* Remove reference to camera in draw method.
* Update bundle size.
* Improve test.
* Improve public API and reduce breaking changes.
* Fix lint
* Fix changelog
* Update comments to avoid showing transform in the docs.
* Fix out-of-date comment
* Remove transform getter.
* Move getMatrixForModel into the example code.
* Remove the `getTerrain` callback.
* TransformProvider only needs the camera now.
* Fix lint, update changelog
---------
Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com>1 parent 7f6b95c commit f2bf791
44 files changed
Lines changed: 1357 additions & 1329 deletions
File tree
- src
- geo
- projection
- style
- style_layer
- ui
- control
- handler
- map_tests
- webgl/draw
- test
- bench/benchmarks
- build
- examples
- integration/browser
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
448 | 448 | | |
449 | 449 | | |
450 | 450 | | |
451 | | - | |
452 | | - | |
453 | | - | |
454 | | - | |
455 | 451 | | |
456 | 452 | | |
457 | 453 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
801 | 801 | | |
802 | 802 | | |
803 | 803 | | |
804 | | - | |
805 | | - | |
806 | | - | |
807 | | - | |
808 | | - | |
809 | | - | |
810 | | - | |
811 | | - | |
812 | | - | |
813 | | - | |
814 | | - | |
815 | | - | |
816 | | - | |
817 | | - | |
818 | | - | |
819 | 804 | | |
820 | 805 | | |
821 | 806 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
978 | 978 | | |
979 | 979 | | |
980 | 980 | | |
981 | | - | |
982 | | - | |
983 | | - | |
984 | | - | |
985 | | - | |
986 | | - | |
987 | | - | |
988 | | - | |
989 | | - | |
990 | | - | |
991 | | - | |
992 | | - | |
993 | | - | |
994 | 981 | | |
995 | 982 | | |
996 | 983 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
493 | 493 | | |
494 | 494 | | |
495 | 495 | | |
496 | | - | |
497 | | - | |
498 | | - | |
499 | | - | |
500 | | - | |
501 | | - | |
502 | | - | |
503 | | - | |
504 | | - | |
505 | 496 | | |
506 | 497 | | |
507 | 498 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1764 | 1764 | | |
1765 | 1765 | | |
1766 | 1766 | | |
1767 | | - | |
| 1767 | + | |
1768 | 1768 | | |
1769 | 1769 | | |
1770 | 1770 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
133 | | - | |
| 133 | + | |
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
| |||
0 commit comments