loleaflet/dist/leaflet.css | 5 +++++ loleaflet/src/control/Control.Buttons.js | 23 +++++++++++++++++++++-- loleaflet/src/control/Parts.js | 2 +- loleaflet/src/layer/tile/TileLayer.js | 11 +++++++---- 4 files changed, 34 insertions(+), 7 deletions(-)
New commits: commit f961995d9697852289bebae69846f01c653e25c2 Author: Mihai Varga <mihai.va...@collabora.com> Date: Mon Aug 10 10:25:38 2015 +0300 loleaflet: use 'resetselection' instead of mouse click diff --git a/loleaflet/src/control/Parts.js b/loleaflet/src/control/Parts.js index 4171f19..23f856f 100644 --- a/loleaflet/src/control/Parts.js +++ b/loleaflet/src/control/Parts.js @@ -22,7 +22,7 @@ L.Map.include({ } if (docLayer._isCursorOverlayVisible) { // a click outside the slide to clear any selection - docLayer.sendMessage('mouse type=buttondown x=-1 y=-1 count=1'); + docLayer.sendMessage('resetselection'); } this.fire('updateparts', { currentPart: docLayer._currentPart, commit 4f181fcfdaeea51645f096aa0237f292d48acb81 Author: Mihai Varga <mihai.va...@collabora.com> Date: Fri Aug 7 12:22:19 2015 +0300 loleaflet: disable buttons in viewing mode diff --git a/loleaflet/dist/leaflet.css b/loleaflet/dist/leaflet.css index 2c8beca..477f86f 100644 --- a/loleaflet/dist/leaflet.css +++ b/loleaflet/dist/leaflet.css @@ -329,10 +329,15 @@ a.leaflet-control-buttons:first-child, a.leaflet-control-buttons:hover:first-child { margin-left: 0px; } + .leaflet-control-buttons-active { border: thin solid; } +.leaflet-control-buttons-disabled{ + opacity: 0.5; + } + .leaflet-control-button-separator { width: 14px; height: 1px; diff --git a/loleaflet/src/control/Control.Buttons.js b/loleaflet/src/control/Control.Buttons.js index 3c971c7..dd7625c 100644 --- a/loleaflet/src/control/Control.Buttons.js +++ b/loleaflet/src/control/Control.Buttons.js @@ -33,6 +33,7 @@ L.Control.Buttons = L.Control.extend({ buttonsName, container, this._onButtonClick); } map.on('commandstatechanged', this._onStateChange, this); + map.on('updatepermission', this._onPermissionUpdate, this); return container; }, @@ -64,7 +65,7 @@ L.Control.Buttons = L.Control.extend({ callback: L.bind(this._onSaveAs, this) }); } - else { + else if (this._map._docLayer._permission === 'edit') { this._map.toggleCommandState(button.uno); } }, @@ -81,6 +82,12 @@ L.Control.Buttons = L.Control.extend({ else if (state === 'false') { L.DomUtil.removeClass(button.el.firstChild, 'leaflet-control-buttons-active'); } + else if (state === 'enabled' && this._map._docLayer._permission === 'edit') { + L.DomUtil.removeClass(button.el.firstChild, 'leaflet-control-buttons-disabled'); + } + else if (state === 'disabled') { + L.DomUtil.removeClass(button.el.firstChild, 'leaflet-control-buttons-disabled'); + } } } }, @@ -99,6 +106,18 @@ L.Control.Buttons = L.Control.extend({ if (e !== false) { this._map.saveAs(e.url, e.format, e.options); } + }, + + _onPermissionUpdate: function (e) { + for (var key in this._buttons) { + var button = this._buttons[key]; + if (e.perm !== 'edit') { + L.DomUtil.addClass(button.el.firstChild, 'leaflet-control-buttons-disabled'); + } + else { + L.DomUtil.removeClass(button.el.firstChild, 'leaflet-control-buttons-disabled'); + } + } } }); diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js index 1d815cc..bcda4aa 100644 --- a/loleaflet/src/layer/tile/TileLayer.js +++ b/loleaflet/src/layer/tile/TileLayer.js @@ -116,12 +116,15 @@ L.TileLayer = L.GridLayer.extend({ this._endMarker.on('drag dragend', this._onSelectionHandleDrag, this); this._textArea = this._map._textArea; this._textArea.focus(); - if (this.options.edit && !this.options.readOnly) { - this._map.setPermission('edit'); - } if (this.options.readOnly) { this._map.setPermission('readonly'); } + else if (this.options.edit) { + this._map.setPermission('edit'); + } + else { + this._map.setPermission('view'); + } this._map.fire('statusindicator', {statusType: 'loleafletloaded'}); }, commit 0a02f3fd7dc1bce512241d4438b443e969f5ca54 Author: Mihai Varga <mihai.va...@collabora.com> Date: Fri Aug 7 11:48:31 2015 +0300 loleaflet: forgot to rename command state event diff --git a/loleaflet/src/control/Control.Buttons.js b/loleaflet/src/control/Control.Buttons.js index 076c642..3c971c7 100644 --- a/loleaflet/src/control/Control.Buttons.js +++ b/loleaflet/src/control/Control.Buttons.js @@ -32,7 +32,7 @@ L.Control.Buttons = L.Control.extend({ button.el = this._createButton(key, button.title, button.iconName, buttonsName, container, this._onButtonClick); } - map.on('statechanged', this._onStateChange, this); + map.on('commandstatechanged', this._onStateChange, this); return container; }, diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js index 05a820f..1d815cc 100644 --- a/loleaflet/src/layer/tile/TileLayer.js +++ b/loleaflet/src/layer/tile/TileLayer.js @@ -341,7 +341,7 @@ L.TileLayer = L.GridLayer.extend({ var unoCmd = unoMsg.match('.uno:(.*)=')[1]; var state = unoMsg.match('.*=(.*)')[1]; if (unoCmd && state) { - this._map.fire('statechanged', {unoCmd : unoCmd, state : state}); + this._map.fire('commandstatechanged', {unoCmd : unoCmd, state : state}); } } else if (textMsg.startsWith('status:')) { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits