-
Notifications
You must be signed in to change notification settings - Fork 16
full screen context menu item added and fixed some context menu related tests #765
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
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
900e5e3
full screen context menu item added and fixedtests
Jacky0299 fed0583
weird test: Checking Context Menu Fullscreen
Jacky0299 11c5ed8
ready for review
Jacky0299 6cbd882
Fix fullscreen test and remove scrolling
AliyanH 4bf1a8f
Merge branch 'Maps4HTML:main' into issue201
Jacky0299 91a48cb
minor changes
Jacky0299 fc898c8
ready to merge
Jacky0299 46d00bc
bug fix (esc button), Peter suggested functions
Jacky0299 5cb8a9b
forward reload back fullscreen button changes
Jacky0299 d9edb58
minor changes
Jacky0299 945533a
Linting
prushforth 9826d93
Change "View fullscreen" to "View Fullscreen"
prushforth e2997c5
minor linting
AliyanH 5d4c25a
Aliyan suggested styling changes
Jacky0299 a3a7a34
Merge branch 'issue201' of https://github.com/Jacky0299/Web-Map-Custo…
Jacky0299 5f8ccbe
time out added between each time back is pressed
Jacky0299 e59d71a
disabling reload button
Jacky0299 8734d1e
bugs fix and new context menu functions
Jacky0299 febd74e
sync changes with web map
Jacky0299 195984f
peter suggested changes
Jacky0299 609b703
Tweak to mapml-viewer, web-map
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
|
@@ -17,17 +17,21 @@ export var ContextMenu = L.Handler.extend({ | |
//setting the items in the context menu and their callback functions | ||
this._items = [ | ||
{ | ||
text: M.options.locale.cmBack + " (<kbd>B</kbd>)", | ||
text: M.options.locale.cmBack + " (<kbd>Alt+Left Arrow</kbd>)", | ||
callback:this._goBack | ||
}, | ||
{ | ||
text: M.options.locale.cmForward + " (<kbd>F</kbd>)", | ||
text: M.options.locale.cmForward + " (<kbd>Alt+Right Arrow</kbd>)", | ||
Comment on lines
+20
to
+24
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks good, just dont forget to add localized versions of this in the extension, similar to what you did for "Exit Fullscreen". Create a PR for the extension. Nice Work on this! |
||
callback:this._goForward | ||
}, | ||
{ | ||
text: M.options.locale.cmReload + " (<kbd>R</kbd>)", | ||
text: M.options.locale.cmReload + " (<kbd>Ctrl+R</kbd>)", | ||
callback:this._reload | ||
}, | ||
{ | ||
text: M.options.locale.btnFullScreen + " (<kbd>F</kbd>)", | ||
callback:this._toggleFullScreen | ||
}, | ||
{ | ||
spacer:"-" | ||
}, | ||
|
@@ -91,7 +95,7 @@ export var ContextMenu = L.Handler.extend({ | |
this._container = L.DomUtil.create("div", "mapml-contextmenu", map._container); | ||
this._container.setAttribute('hidden', ''); | ||
|
||
for (let i = 0; i < 5; i++) { | ||
for (let i = 0; i < 6; i++) { | ||
this._items[i].el = this._createItem(this._container, this._items[i]); | ||
} | ||
|
||
|
@@ -101,15 +105,15 @@ export var ContextMenu = L.Handler.extend({ | |
|
||
this._clickEvent = null; | ||
|
||
for(let i =0;i<this._items[4].submenu.length;i++){ | ||
this._createItem(this._coordMenu,this._items[4].submenu[i],i); | ||
for(let i =0;i<this._items[5].submenu.length;i++){ | ||
this._createItem(this._coordMenu,this._items[5].submenu[i],i); | ||
} | ||
|
||
this._items[5].el = this._createItem(this._container, this._items[5]); | ||
this._items[6].el = this._createItem(this._container, this._items[6]); | ||
this._items[7].el = this._createItem(this._container, this._items[7]); | ||
this._items[8].el = this._createItem(this._container, this._items[8]); | ||
this._items[9].el = this._createItem(this._container, this._items[9]); | ||
this._items[10].el = this._createItem(this._container, this._items[10]); | ||
|
||
this._layerMenu = L.DomUtil.create("div", "mapml-contextmenu mapml-layer-menu", map._container); | ||
this._layerMenu.setAttribute('hidden', ''); | ||
|
@@ -222,6 +226,11 @@ export var ContextMenu = L.Handler.extend({ | |
mapEl.reload(); | ||
}, | ||
|
||
_toggleFullScreen: function(e){ | ||
let mapEl = e instanceof KeyboardEvent?this._map.options.mapEl:this.options.mapEl; | ||
mapEl._toggleFullScreen(); | ||
}, | ||
|
||
_toggleControls: function(e){ | ||
let mapEl = e instanceof KeyboardEvent?this._map.options.mapEl:this.options.mapEl; | ||
mapEl._toggleControls(); | ||
|
@@ -615,9 +624,6 @@ export var ContextMenu = L.Handler.extend({ | |
if(this._map._container.parentNode.activeElement.parentNode.classList.contains("mapml-contextmenu")) | ||
this._map._container.parentNode.activeElement.click(); | ||
break; | ||
case 66: //B KEY | ||
this._goBack(e); | ||
break; | ||
case 67: //C KEY | ||
this._copyCoords({ | ||
latlng:this._map.getCenter() | ||
|
@@ -629,19 +635,16 @@ export var ContextMenu = L.Handler.extend({ | |
case 77: //M KEY | ||
this._copyMapML(e); | ||
break; | ||
case 70: //F KEY | ||
this._goForward(e); | ||
break; | ||
case 76: //L KEY | ||
if(this._layerClicked.className.includes('mapml-layer-item')) | ||
this._copyLayer(e); | ||
break; | ||
case 70: //F KEY | ||
this._toggleFullScreen(e); | ||
break; | ||
case 80: //P KEY | ||
this._paste(e); | ||
break; | ||
case 82: //R KEY | ||
this._reload(e); | ||
break; | ||
case 84: //T KEY | ||
this._toggleControls(e); | ||
break; | ||
|
@@ -697,5 +700,39 @@ export var ContextMenu = L.Handler.extend({ | |
_onItemMouseOut: function (e) { | ||
L.DomUtil.removeClass(e.target || e.srcElement, 'over'); | ||
this._hideCoordMenu(e); | ||
}, | ||
|
||
toggleContextMenuItem: function (options,state) { | ||
options = options.toUpperCase(); | ||
if (state === "disabled") { | ||
if (options === "CONTROLS") { | ||
this._items[8].el.el.disabled = true; | ||
} else if (options === "BACK") { | ||
this._items[0].el.el.disabled = true; | ||
} else if (options === "FORWARD") { | ||
this._items[1].el.el.disabled = true; | ||
} else if (options === "RELOAD") { | ||
this._items[2].el.el.disabled = true; | ||
} | ||
} else if(state === "enabled") { | ||
if (options === "CONTROLS") { | ||
this._items[8].el.el.disabled = false; | ||
} else if (options === "BACK") { | ||
this._items[0].el.el.disabled = false; | ||
} else if (options === "FORWARD") { | ||
this._items[1].el.el.disabled = false; | ||
} else if (options === "RELOAD") { | ||
this._items[2].el.el.disabled = false; | ||
} | ||
} | ||
}, | ||
|
||
setViewFullScreenInnerHTML: function (options) { | ||
if (options === 'view') { | ||
this._map.contextMenu._items[3].el.el.innerHTML = M.options.locale.btnFullScreen + " (<kbd>F</kbd>)"; | ||
} | ||
else if (options === 'exit') { | ||
this._map.contextMenu._items[3].el.el.innerHTML = M.options.locale.btnExitFullScreen + " (<kbd>F</kbd>)"; | ||
} | ||
} | ||
}); |
This file contains hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.