-
Notifications
You must be signed in to change notification settings - Fork 640
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: 默认升级 MapNext 至 [email protected]
- Loading branch information
Showing
134 changed files
with
466 additions
and
599 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,32 @@ | ||
# `map` | ||
## Map | ||
|
||
> TODO: description | ||
Map fork from [[email protected]](https://github.com/maplibre/maplibre-gl-js), keep event loop, responds user interaction and updates the internal state of the map (current viewport, camera angle, etc.) | ||
|
||
## Usage | ||
```mermaid | ||
sequenceDiagram | ||
actor user | ||
participant DOM | ||
participant handler_manager | ||
participant handler | ||
participant camera | ||
participant transform | ||
participant map | ||
``` | ||
const map = require('map'); | ||
user->>camera: map#setCenter, map#panTo | ||
camera->>transform: update | ||
camera->>map: fire move event | ||
map->>map: _render() | ||
// TODO: DEMONSTRATE API | ||
user->>DOM: resize, pan,<br>click, scroll,<br>... | ||
DOM->>handler_manager: DOM events | ||
handler_manager->>handler: forward event | ||
handler-->>handler_manager: HandlerResult | ||
handler_manager->>transform: update | ||
handler_manager->>map: fire move event | ||
map->>map: _render() | ||
``` | ||
|
||
- [Transform](../src/geo/transform.ts) holds the current viewport details (pitch, zoom, bearing, bounds, etc.). Two places in the code update transform directly: | ||
- [Camera](../src/ui/camera.ts) (parent class of [Map](../src/ui/map)) in response to explicit calls to [Camera#panTo](../src/ui/camera.ts#L207), [Camera#setCenter](../src/ui/camera.ts#L169) | ||
- [HandlerManager](../src/ui/handler_manager.ts) in response to DOM events. It forwards those events to interaction processors that live in [src/ui/handler](../src/ui/handler), which accumulate a merged [HandlerResult](../src/ui/handler_manager.ts#L64) that kick off a render frame loop, decreasing the inertia and nudging map.transform by that amount on each frame from [HandlerManager#\_updateMapTransform()](../src/ui/handler_manager.ts#L413). That loop continues in the inertia decreases to 0. | ||
- Both camera and handler_manager are responsible for firing `move`, `zoom`, `movestart`, `moveend`, ... events on the map after they update transform. Each of these events (along with style changes and data load events) triggers a call to [Map#\_render()](../src/ui/map.ts#L2480) which renders a single frame of the map. |
26 changes: 13 additions & 13 deletions
26
packages/map/src/map-next/ui/camera.test.ts → packages/map/__tests__/camera.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../map/src/map-next/geo/edge_insets.test.ts → ...ges/map/__tests__/geo/edge_insets.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...p/src/map-next/geo/lng_lat_bounds.test.ts → .../map/__tests__/geo/lng_lat_bounds.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
.../map-next/geo/mercator_coordinate.test.ts → ...__tests__/geo/mercator_coordinate.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...es/map/src/map-next/geo/transform.test.ts → packages/map/__tests__/geo/transform.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
.../src/map-next/ui/handler/box_zoom.test.ts → ...es/map/__tests__/handler/box_zoom.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
...map-next/ui/handler/dblclick_zoom.test.ts → ...p/__tests__/handler/dblclick_zoom.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 5 additions & 5 deletions
10
.../src/map-next/ui/handler/drag_pan.test.ts → ...es/map/__tests__/handler/drag_pan.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 6 additions & 6 deletions
12
...c/map-next/ui/handler/drag_rotate.test.ts → ...map/__tests__/handler/drag_rotate.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 5 additions & 5 deletions
10
.../src/map-next/ui/handler/keyboard.test.ts → ...es/map/__tests__/handler/keyboard.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 5 additions & 5 deletions
10
...src/map-next/ui/handler/map_event.test.ts → ...s/map/__tests__/handler/map_event.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 6 additions & 6 deletions
12
.../map-next/ui/handler/mouse_rotate.test.ts → ...ap/__tests__/handler/mouse_rotate.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
10 changes: 5 additions & 5 deletions
10
...c/map-next/ui/handler/scroll_zoom.test.ts → ...map/__tests__/handler/scroll_zoom.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
...map-next/ui/handler/tap_drag_zoom.test.ts → ...p/__tests__/handler/tap_drag_zoom.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
packages/map/src/map-next/util/test/util.ts → packages/map/__tests__/libs/util.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.