Document Shift-Click and add Ctrl-Shift-click to edit datalayer
This commit is contained in:
parent
247efc5345
commit
3cee4fda01
3 changed files with 23 additions and 5 deletions
|
@ -333,8 +333,12 @@ L.U.FeatureMixin = {
|
|||
this.view(e)
|
||||
} else if (!this.isReadOnly()) {
|
||||
if (e.originalEvent.shiftKey) {
|
||||
if (e.originalEvent.ctrlKey) {
|
||||
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') + ' (Shift-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-Shift-click)',
|
||||
callback: this.datalayer.edit,
|
||||
context: this.datalayer,
|
||||
iconCls: 'umap-edit',
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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')
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue