diff --git a/umap/static/umap/js/umap.controls.js b/umap/static/umap/js/umap.controls.js index 05a375aa..0cd0bb73 100644 --- a/umap/static/umap/js/umap.controls.js +++ b/umap/static/umap/js/umap.controls.js @@ -172,7 +172,7 @@ L.U.ToggleEditAction = L.U.BaseFeatureAction.extend({ options: { toolbarIcon: { className: 'umap-toggle-edit', - tooltip: L._('Toggle edit mode (Shift+Click)'), + tooltip: L._('Toggle edit mode (⇧+Click)'), }, }, diff --git a/umap/static/umap/js/umap.features.js b/umap/static/umap/js/umap.features.js index a414d1a9..9b7ac8b2 100644 --- a/umap/static/umap/js/umap.features.js +++ b/umap/static/umap/js/umap.features.js @@ -333,8 +333,12 @@ L.U.FeatureMixin = { this.view(e) } else if (!this.isReadOnly()) { if (e.originalEvent.shiftKey) { - if (this._toggleEditing) this._toggleEditing(e) - else this.edit(e) + if (e.originalEvent.ctrlKey || e.originalEvent.metaKey) { + this.datalayer.edit(e) + } else { + if (this._toggleEditing) this._toggleEditing(e) + else this.edit(e) + } } else { new L.Toolbar.Popup(e.latlng, { className: 'leaflet-inplace-toolbar', @@ -389,7 +393,7 @@ L.U.FeatureMixin = { let items = ['-'] if (this.map.editedFeature !== this) { items.push({ - text: L._('Edit this feature'), + text: L._('Edit this feature') + ' (⇧+Click)', callback: this.edit, context: this, iconCls: 'umap-edit', @@ -397,7 +401,7 @@ L.U.FeatureMixin = { } items = items.concat( { - text: L._("Edit feature's layer"), + text: L._("Edit feature's layer") + ' (Ctrl+⇧+Click)', callback: this.datalayer.edit, context: this.datalayer, iconCls: 'umap-edit', diff --git a/umap/static/umap/js/umap.ui.js b/umap/static/umap/js/umap.ui.js index 7e7a861f..6a87f193 100644 --- a/umap/static/umap/js/umap.ui.js +++ b/umap/static/umap/js/umap.ui.js @@ -64,6 +64,7 @@ L.U.UI = L.Evented.extend({ }, closePanel: function () { + this._panel.innerHTML = '' this.resetPanelClassName() L.DomUtil.removeClass(this.parent, 'umap-ui') this.fire('panel:closed') diff --git a/umap/static/umap/test/Feature.js b/umap/static/umap/test/Feature.js index cff88f7d..1f5c1117 100644 --- a/umap/static/umap/test/Feature.js +++ b/umap/static/umap/test/Feature.js @@ -28,8 +28,21 @@ describe('L.U.FeatureMixin', function () { assert.ok(qs('path[fill="DarkBlue"]')) // Polygon }) - it('should take into account styles changes made in the datalayer', function () { + it('should toggle edit panel on shift-clic', function () { enableEdit() + happen.click(qs('path[fill="DarkBlue"]'), {shiftKey: true}) + assert.ok(qs('form#umap-feature-properties')) + happen.click(qs('path[fill="DarkBlue"]'), {shiftKey: true}) + assert.notOk(qs('form#umap-feature-properties')) + }) + + it('should open datalayer edit panel on ctrl-shift-clic', function () { + enableEdit() + happen.click(qs('path[fill="DarkBlue"]'), {shiftKey: true, ctrlKey: true}) + assert.ok(qs('div.umap-layer-properties-container')) + }) + + it('should take into account styles changes made in the datalayer', function () { happen.click( qs('#browse_data_toggle_' + L.stamp(this.datalayer) + ' .layer-edit') )