Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve typescript bindings #1369

Merged
merged 1 commit into from
Feb 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/components/interactive-map.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ type State = {
};

export type MapEvent = MjolnirEvent & {
point: Array<number>,
lngLat: Array<number>,
point: [x: number, y: number],
lngLat: [longitude: number, latitude: number],
features?: Array<any>
};

Expand Down
26 changes: 15 additions & 11 deletions src/utils/map-controller.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,22 @@ export type MjolnirEvent = {
type: string,
center: {x: number, y: number},
offsetCenter: {x: number, y: number},
deltaX: number,
deltaY: number,
delta: number,
scale: number,
rotation: number,
pointerType: string,
metaKey: boolean,
rightButton: boolean,
stopPropagation: Function,
preventDefault: Function,
deltaX?: number,
deltaY?: number,
delta?: number,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are some of the fields deleted? They are accessed in map-controller.js:

  • deltaX
  • deltaY
  • scale
  • rotation

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm they aren't documented as existing so I wasn't sure if they existed, but given we use them then they certainly do exist. So restored them (but made them optional, because they only exist for some events)

scale?: number,
rotation?: number,
pointerType?: string,
metaKey?: boolean,
key?: number,
leftButton?: boolean,
middleButton?: boolean,
rightButton?: boolean,
stopPropagation: () => void,
stopImmediatePropagation: () => void,
preventDefault: () => void,
target: HTMLElement,
srcEvent: any
srcEvent: MouseEvent | PointerEvent | TouchEvent
};

export const LINEAR_TRANSITION_PROPS: any;
Expand Down