[Libreoffice-commits] online.git: Branch 'distro/collabora/milestone-7' - loleaflet/dist loleaflet/src

Marco Cecchetti marco.cecchetti at collabora.com
Mon Feb 1 17:44:21 UTC 2016


 loleaflet/dist/cursors/fill.cur       |binary
 loleaflet/dist/cursors/fill.png       |binary
 loleaflet/src/layer/marker/Cursor.js  |   36 ++++++++++++++++++++++++++++++++++
 loleaflet/src/layer/tile/TileLayer.js |    5 +++-
 4 files changed, 40 insertions(+), 1 deletion(-)

New commits:
commit 17e9dfcf8a02ddbd7ab00b8f4e4678eec1a867c5
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
Date:   Mon Feb 1 18:39:07 2016 +0100

    loleaflet - in highlighting mode a custom cursor is used
    
    When the user clicks on the background text color control while
    editing a text document, loleaflet enter in highlighting mode (exactly
    as Wrieter does).
    In order to notify that loleaflet has switched to highlighting mode
    the cursor changes is shape to a small bottle in the act of dropping
    ink.
    
    Change-Id: Ic9a5a636df9fd6071e38edc7e0fc2e11e037a517

diff --git a/loleaflet/dist/cursors/fill.cur b/loleaflet/dist/cursors/fill.cur
new file mode 100644
index 0000000..78f5fad
Binary files /dev/null and b/loleaflet/dist/cursors/fill.cur differ
diff --git a/loleaflet/dist/cursors/fill.png b/loleaflet/dist/cursors/fill.png
new file mode 100644
index 0000000..220641b
Binary files /dev/null and b/loleaflet/dist/cursors/fill.png differ
diff --git a/loleaflet/src/layer/marker/Cursor.js b/loleaflet/src/layer/marker/Cursor.js
index b4cd5f1..f98e323 100644
--- a/loleaflet/src/layer/marker/Cursor.js
+++ b/loleaflet/src/layer/marker/Cursor.js
@@ -90,3 +90,39 @@ L.Cursor = L.Layer.extend({
 L.cursor = function (latlng, options) {
 	return new L.Cursor(latlng, options);
 };
+
+L.Cursor.imagePath = (function () {
+	var scripts = document.getElementsByTagName('script'),
+		leafletRe = /[\/^]leaflet[\-\._]?([\w\-\._]*)\.js\??/;
+
+	var i, len, src, path;
+
+	for (i = 0, len = scripts.length; i < len; i++) {
+		src = scripts[i].src;
+
+		if (src.match(leafletRe)) {
+			path = src.split(leafletRe)[0];
+			return (path ? path + '/' : '') + 'cursors';
+		}
+	}
+}());
+
+L.Cursor.getCustomCursor = function( cursorName ) {
+	var customCursor,
+		isCustomCursor = true,
+		top = 0,
+		left = 0;
+
+	if ( cursorName === 'fill' ) {
+		top = 16; left = 7;
+	} else {
+		isCustomCursor = false;
+	}
+
+	if (isCustomCursor) {
+		customCursor = L.Browser.ie ? // IE10 does not like item with left/top position in the url list
+			'url(' + L.Cursor.imagePath + '/' + cursorName + '.cur), default' :
+			'url(' + L.Cursor.imagePath + '/' + cursorName + '.png) ' + left + ' ' + top + ', default';
+	}
+	return customCursor
+};
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index 71855f5..fc46e6e 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -440,7 +440,10 @@ L.TileLayer = L.GridLayer.extend({
 
 	_onMousePointerMsg: function (textMsg) {
 		textMsg = textMsg.substring(14); // "mousepointer: "
-		this._map._container.style.cursor = textMsg;
+		textMsg = L.Cursor.getCustomCursor(textMsg) || textMsg;
+		if (this._map._container.style.cursor != textMsg) {
+			this._map._container.style.cursor = textMsg;
+		}
 	},
 
 	_onHyperlinkClickedMsg: function (textMsg) {


More information about the Libreoffice-commits mailing list