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

geolocation button closes issue#780 #800

Merged
merged 42 commits into from
Apr 5, 2023
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
e0b128c
geolocation button
Jacky0299 Mar 15, 2023
9484cdb
Delete index.js
Jacky0299 Mar 15, 2023
49b3487
Delete multipleExtents.html
Jacky0299 Mar 15, 2023
aadc794
some changes to the file
Jacky0299 Mar 15, 2023
968b1d9
Merge branch 'issue780' of https://github.com/Jacky0299/Web-Map-Custo…
Jacky0299 Mar 15, 2023
af85058
button name change
Jacky0299 Mar 16, 2023
de402fc
Merge branch 'main' of https://github.com/Maps4HTML/Web-Map-Custom-El…
Jacky0299 Mar 16, 2023
b86c0d4
minor edits
prushforth Mar 20, 2023
387ffda
geolocation sync with controlslist api
Jacky0299 Mar 20, 2023
8cd9162
tests fixed and syncing web-map
Jacky0299 Mar 20, 2023
94c69e1
Peter suggested changes
Jacky0299 Mar 21, 2023
f13c8f0
locate api
Jacky0299 Mar 23, 2023
f155ba0
locateapi and locate button test
Jacky0299 Mar 24, 2023
495c551
tests
Jacky0299 Mar 27, 2023
d4bcb2c
locate button title changes when its state changes
Jacky0299 Mar 28, 2023
f0220f3
locatebutton states test
Jacky0299 Mar 29, 2023
709a288
web-map syncing
Jacky0299 Mar 29, 2023
88c449e
Remove the word "control" from button title
prushforth Mar 29, 2023
31c6309
Merge branch 'issue780' of https://github.com/Jacky0299/Web-Map-Custo…
prushforth Mar 29, 2023
df109df
Remove the word "control" from button title
prushforth Mar 29, 2023
c91d0c4
Fix test
prushforth Mar 29, 2023
5b2b6ff
grunt file change
Jacky0299 Mar 29, 2023
ffcdf13
Merge branch 'issue780' of https://github.com/Jacky0299/Web-Map-Custo…
Jacky0299 Mar 29, 2023
9452f0e
Finalize text strings prior to localization
prushforth Mar 29, 2023
1de354d
Localize text strings for location control button states
prushforth Mar 29, 2023
0ae2302
Merge branch 'issue780' of https://github.com/Jacky0299/Web-Map-Custo…
prushforth Mar 29, 2023
4697f54
custom marker
Jacky0299 Mar 29, 2023
9bf5f7b
small changes and tests
Jacky0299 Mar 30, 2023
2fc5334
locate APi bug fix
Jacky0299 Mar 30, 2023
98c769b
minor styling fix
AliyanH Mar 30, 2023
830c888
marker image made to svg
Jacky0299 Apr 3, 2023
0cdff5d
Alliyan suggested changes
Jacky0299 Apr 3, 2023
c993c2c
locateapi test bug fix
Jacky0299 Apr 3, 2023
31d6402
marker title changes depends on statr
Jacky0299 Apr 3, 2023
c06ef45
Localize text strings for my current or cached location marker
prushforth Apr 3, 2023
76bfb75
Update test to use variables for geolocation button states
prushforth Apr 4, 2023
76191b6
tooltip focus
Jacky0299 Apr 4, 2023
f7b0341
tooltip test added
Jacky0299 Apr 4, 2023
0deb72b
geolocationbutton code refactored
Jacky0299 Apr 5, 2023
796cb2b
Merge branch 'main' of https://github.com/Maps4HTML/Web-Map-Custom-El…
Jacky0299 Apr 5, 2023
ba0052f
fixed tests and small fixes
Jacky0299 Apr 5, 2023
451a6d2
Formatting
prushforth Apr 5, 2023
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
10 changes: 9 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module.exports = function(grunt) {
},
combine: {
files: {
'dist/mapml.css': ['node_modules/leaflet/dist/leaflet.css', 'src/mapml.css']
'dist/mapml.css': ['node_modules/leaflet/dist/leaflet.css', 'node_modules/leaflet.locatecontrol/dist/L.Control.Locate.css', 'node_modules/leaflet.locatecontrol/dist/L.Control.Locate.mapbox.css', 'src/mapml.css']
AliyanH marked this conversation as resolved.
Show resolved Hide resolved
}
}
},
Expand Down Expand Up @@ -87,6 +87,14 @@ module.exports = function(grunt) {
filter: 'isFile',
src: ['index.html'],
dest: 'dist/'
},
{
expand: true,
cwd: 'node_modules/leaflet.locatecontrol/src/',
flatten: true,
filter: 'isFile',
src: ['L.Control.Locate.js'],
dest: 'dist/'
}
],
options: {
Expand Down
13 changes: 13 additions & 0 deletions package-lock.json

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

7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"jest": "jest --verbose --noStackTrace"
},
"devDependencies": {
"@playwright/test": "^1.24.2",
"diff": "^5.1.0",
"express": "^4.17.1",
"grunt": "^1.4.0",
Expand All @@ -54,7 +55,6 @@
"jest-playwright-preset": "^1.7.0",
"leaflet": "^1.9.3",
"path": "^0.12.7",
"@playwright/test": "^1.24.2",
"playwright": "^1.24.2",
"proj4": "^2.6.2",
"proj4leaflet": "^1.0.2",
Expand All @@ -63,5 +63,8 @@
"files": [
"dist",
"*.md"
]
],
"dependencies": {
"leaflet.locatecontrol": "^0.79.0"
}
}
13 changes: 13 additions & 0 deletions src/mapml-viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,19 @@ export class MapViewer extends HTMLElement {
totalSize += 49;
this._fullScreenControl = M.fullscreenButton().addTo(this._map);
}
if (this.getAttribute("controlslist") === "geolocation" && !this._geolocationButton && (totalSize + 49) <= mapSize){
AliyanH marked this conversation as resolved.
Show resolved Hide resolved
totalSize += 49;
this._geolocationButton = M.geolocationButton({
showPopup: false,
strings: {
title: "Locate"
AliyanH marked this conversation as resolved.
Show resolved Hide resolved
},
position: "bottomright",
locateOptions: {
maxZoom: 16
prushforth marked this conversation as resolved.
Show resolved Hide resolved
},
},this._map);
prushforth marked this conversation as resolved.
Show resolved Hide resolved
}
}

// Sets controls by hiding/unhiding them based on the map attribute
Expand Down
4 changes: 4 additions & 0 deletions src/mapml/control/GeolocationButton.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import '../../../dist/L.Control.Locate';
export var geolocationButton = function (options, map) {
L.control.locate(options).addTo(map);
};
5 changes: 4 additions & 1 deletion src/mapml/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ import { ContextMenu } from './handlers/ContextMenu';
import { Util } from './utils/Util';
import { ReloadButton, reloadButton } from './control/ReloadButton';
import { FullscreenButton, fullscreenButton } from './control/FullscreenButton';
import {attributionControl} from "./control/AttributionControl";
import {attributionControl} from "./control/AttributionControl";
import {geolocationButton} from "./control/GeolocationButton";
import { Crosshair, crosshair } from "./layers/Crosshair";
import { Feature, feature } from "./features/feature";
import { FeatureRenderer, featureRenderer } from './features/featureRenderer';
Expand Down Expand Up @@ -659,6 +660,8 @@ M.fullscreenButton = fullscreenButton;

M.attributionControl = attributionControl;

M.geolocationButton = geolocationButton;

M.StaticTileLayer = StaticTileLayer;
M.staticTileLayer = staticTileLayer;

Expand Down