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

Updating to Maplibre 3.3.0 #49

Merged
merged 4 commits into from
Aug 21, 2023
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
68 changes: 41 additions & 27 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"format": "prettier --write \"src/**/*.{js,ts,tsx}\"",
"lint": "eslint --fix \"src/**/*.{js,ts}\"",
"doc": "rm -rf docs/* && typedoc --out docs && cp -r images docs/",
"prepare": "npm run format && npm run lint && npm run build && npm run doc && cp -r demos docs/"
"prepare": "npm run format && npm run lint && npm run build && npm run doc"
},
"author": "MapTiler",
"devDependencies": {
Expand All @@ -57,14 +57,14 @@
"rollup-plugin-swc": "^0.2.1",
"serve": "^14.2.0",
"terser": "^5.17.1",
"typedoc": "^0.24.4",
"typedoc": "^0.24.8",
"typescript": "^5.1.6"
},
"dependencies": {
"@maptiler/client": "^1.5.0",
"events": "^3.3.0",
"js-base64": "^3.7.4",
"maplibre-gl": "3.1.0",
"maplibre-gl": "3.3.0",
"uuid": "^9.0.0"
}
}
28 changes: 14 additions & 14 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,19 @@ const copyCssPlugin = copy({
],
});

const copyUmdBundle = copy({
targets: [
{
src: `dist/${outputName}.umd.js`,
dest: "demos/",
},
{
src: `dist/${outputName}.css`,
dest: "demos/",
},
],
hook: "writeBundle"
});
// const copyUmdBundle = copy({
// targets: [
// {
// src: `dist/${outputName}.umd.js`,
// dest: "demos/",
// },
// {
// src: `dist/${outputName}.css`,
// dest: "demos/",
// },
// ],
// hook: "writeBundle"
// });


const bundles = [
Expand Down Expand Up @@ -78,7 +78,7 @@ const bundles = [
globals(),
json(),
esbuild(),
copyUmdBundle,
// copyUmdBundle,
],
output: [
{
Expand Down
20 changes: 13 additions & 7 deletions src/MaptilerGeolocateControl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@ const LngLatBounds = maplibregl.LngLatBounds;
export class MaptilerGeolocateControl extends GeolocateControl {
private lastUpdatedCenter = new LngLat(0, 0);



/**
* Update the camera location to center on the current position
*
* @param {Position} position the Geolocation API Position
* @private
*/
_updateCamera(position: GeolocationPosition) {
_updateCamera = (position: GeolocationPosition) => {
const center = new LngLat(
position.coords.longitude,
position.coords.latitude
Expand Down Expand Up @@ -73,9 +75,9 @@ export class MaptilerGeolocateControl extends GeolocateControl {

this.lastUpdatedCenter = this._map.getCenter();
});
}
};

_setupUI(supported: boolean) {
_setupUI = (supported: boolean) => {
this.lastUpdatedCenter = this._map.getCenter();

this._container.addEventListener("contextmenu", (e: MouseEvent) =>
Expand Down Expand Up @@ -116,7 +118,10 @@ export class MaptilerGeolocateControl extends GeolocateControl {
if (this.options.showUserLocation) {
this._dotElement = DOMcreate("div", "maplibregl-user-location-dot");

this._userLocationDotMarker = new Marker(this._dotElement);
console.log('debug01');
Copy link
Member

Choose a reason for hiding this comment

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

Forgotten console.log :-)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

OOpsie! Thanks!



this._userLocationDotMarker = new Marker({element: this._dotElement});

this._circleElement = DOMcreate(
"div",
Expand Down Expand Up @@ -168,7 +173,8 @@ export class MaptilerGeolocateControl extends GeolocateControl {
}
});
}
}
};


_updateCircleRadius() {
if (
Expand Down Expand Up @@ -196,9 +202,9 @@ export class MaptilerGeolocateControl extends GeolocateControl {
this._circleElement.style.height = `${circleDiameter}px`;
}

_onZoom() {
_onZoom = () => {
if (this.options.showUserLocation && this.options.showAccuracyCircle) {
this._updateCircleRadius();
}
}
};
}
4 changes: 2 additions & 2 deletions src/MaptilerNavigationControl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export class MaptilerNavigationControl extends NavigationControl {
/**
* Overloading: Limit how flat the compass icon can get
*/
_rotateCompassArrow() {
_rotateCompassArrow = () => {
const rotate = this.options.visualizePitch
? `scale(${Math.min(
1.5,
Expand All @@ -62,5 +62,5 @@ export class MaptilerNavigationControl extends NavigationControl {
: `rotate(${this._map.transform.angle * (180 / Math.PI)}deg)`;

this._compassIcon.style.transform = rotate;
}
};
}