Skip to content

Commit

Permalink
fix: add new ControlPosition constants (#571)
Browse files Browse the repository at this point in the history
fixes #548
  • Loading branch information
usefulthink authored Nov 30, 2023
1 parent 77709ee commit a33a39d
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 28 deletions.
47 changes: 33 additions & 14 deletions src/maps/controls/controlposition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,36 @@
* limitations under the License.
*/

export enum ControlPosition {
BOTTOM_CENTER = 0.0,
BOTTOM_LEFT = 1.0,
BOTTOM_RIGHT = 2.0,
LEFT_BOTTOM = 3.0,
LEFT_CENTER = 4.0,
LEFT_TOP = 5.0,
RIGHT_BOTTOM = 6.0,
RIGHT_CENTER = 7.0,
RIGHT_TOP = 8.0,
TOP_CENTER = 9.0,
TOP_LEFT = 10.0,
TOP_RIGHT = 11.0,
}
export const ControlPosition = {
TOP_LEFT: 1,
TOP_CENTER: 2,
TOP: 2,
TOP_RIGHT: 3,
LEFT_CENTER: 4,
LEFT_TOP: 5,
LEFT: 5,
LEFT_BOTTOM: 6,
RIGHT_TOP: 7,
RIGHT: 7,
RIGHT_CENTER: 8,
RIGHT_BOTTOM: 9,
BOTTOM_LEFT: 10,
BOTTOM_CENTER: 11,
BOTTOM: 11,
BOTTOM_RIGHT: 12,
CENTER: 13,
BLOCK_START_INLINE_START: 14,
BLOCK_START_INLINE_CENTER: 15,
BLOCK_START_INLINE_END: 16,
INLINE_START_BLOCK_CENTER: 17,
INLINE_START_BLOCK_START: 18,
INLINE_START_BLOCK_END: 19,
INLINE_END_BLOCK_START: 20,
INLINE_END_BLOCK_CENTER: 21,
INLINE_END_BLOCK_END: 22,
BLOCK_END_INLINE_START: 23,
BLOCK_END_INLINE_CENTER: 24,
BLOCK_END_INLINE_END: 25,
} as const;
export type ControlPosition =
(typeof ControlPosition)[keyof typeof ControlPosition];
22 changes: 8 additions & 14 deletions src/maps/maps/map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { LatLng, LatLngBounds } from "../coordinates/latlng";
import { MapsEventListener } from "../event/event";
import { MVCObject } from "../event/mvcobject";
import { FeatureLayer } from "./featurelayer";
import { ControlPosition } from "../controls/controlposition";

export class Map_ extends MVCObject implements google.maps.Map {
public controls: Array<google.maps.MVCArray<HTMLElement>>;
Expand Down Expand Up @@ -147,20 +148,13 @@ export class Map_ extends MVCObject implements google.maps.Map {
constructor(mapDiv: Element | null, opts?: google.maps.MapOptions) {
super();
this.data = new google.maps.Data();
this.controls = [
new google.maps.MVCArray<HTMLElement>(), // BOTTOM_CENTER
new google.maps.MVCArray<HTMLElement>(), // BOTTOM_LEFT
new google.maps.MVCArray<HTMLElement>(), // BOTTOM_RIGHT
new google.maps.MVCArray<HTMLElement>(), // LEFT_BOTTOM
new google.maps.MVCArray<HTMLElement>(), // LEFT_CENTER
new google.maps.MVCArray<HTMLElement>(), // LEFT_TOP
new google.maps.MVCArray<HTMLElement>(), // RIGHT_BOTTOM
new google.maps.MVCArray<HTMLElement>(), // RIGHT_CENTER
new google.maps.MVCArray<HTMLElement>(), // RIGHT_TOP
new google.maps.MVCArray<HTMLElement>(), // TOP_CENTER
new google.maps.MVCArray<HTMLElement>(), // TOP_LEFT
new google.maps.MVCArray<HTMLElement>(), // TOP_RIGHT
];

this.controls = [];

for (const [_, value] of Object.entries(ControlPosition)) {
this.controls[value] = new google.maps.MVCArray<HTMLElement>();
}

this.mapTypes = new google.maps.MVCObject();
this.overlayMapTypes = new google.maps.MVCArray();
}
Expand Down

0 comments on commit a33a39d

Please sign in to comment.