[Libreoffice-commits] online.git: loleaflet/dist loleaflet/src

Mihai Varga mihai.varga at collabora.com
Mon Aug 31 05:14:01 PDT 2015


 loleaflet/dist/leaflet.css            |   17 +++++++++++++++++
 loleaflet/src/layer/marker/Icon.js    |   10 ++++++++--
 loleaflet/src/layer/tile/TileLayer.js |   10 ++++------
 3 files changed, 29 insertions(+), 8 deletions(-)

New commits:
commit 97fcf892c2213eb09480f16a8cd6bea7b5fa5954
Author: Mihai Varga <mihai.varga at collabora.com>
Date:   Mon Aug 31 15:10:21 2015 +0300

    loleaflet: modifiable selection handles

diff --git a/loleaflet/dist/leaflet.css b/loleaflet/dist/leaflet.css
index 0ec0399..7923877 100644
--- a/loleaflet/dist/leaflet.css
+++ b/loleaflet/dist/leaflet.css
@@ -40,6 +40,23 @@
 .leaflet-marker-shadow {
 	display: block;
 	}
+
+.leaflet-selection-marker-start {
+	margin-left: -28px;
+	margin-top: -2px;
+	width: 30px;
+	height: 44px;
+	background-image: url(images/handle_start.png);
+	}
+
+.leaflet-selection-marker-end {
+	margin-left: -2px;
+	margin-top: -2px;
+	width: 30px;
+	height: 44px;
+	background-image: url(images/handle_end.png);
+	}
+
 /* .leaflet-container svg: reset svg max-width decleration shipped in Joomla! (joomla.org) 3.x */
 /* .leaflet-container img: map is broken in FF if you have max-width: 100% on tiles */
 .leaflet-container svg,
diff --git a/loleaflet/src/layer/marker/Icon.js b/loleaflet/src/layer/marker/Icon.js
index 58d5fd3..b50ca13 100644
--- a/loleaflet/src/layer/marker/Icon.js
+++ b/loleaflet/src/layer/marker/Icon.js
@@ -15,6 +15,7 @@ L.Icon = L.Class.extend({
 		shadowSize: (Point)
 		shadowAnchor: (Point)
 		className: (String)
+		asDiv: (Boolean) (optional, creates the icon as a div)
 	},
 	*/
 
@@ -33,14 +34,19 @@ L.Icon = L.Class.extend({
 	_createIcon: function (name, oldIcon) {
 		var src = this._getIconUrl(name);
 
-		if (!src) {
+		if (!src && !this.options.asDiv) {
 			if (name === 'icon') {
 				throw new Error('iconUrl not set in Icon options (see the docs).');
 			}
 			return null;
 		}
 
-		var img = this._createImg(src, oldIcon && oldIcon.tagName === 'IMG' ? oldIcon : null);
+		if (this.options.asDiv) {
+			var img = document.createElement('div');
+		}
+		else {
+			img = this._createImg(src, oldIcon && oldIcon.tagName === 'IMG' ? oldIcon : null);
+		}
 		this._setIconStyles(img, name);
 
 		return img;
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index 1e17486..2f0330a 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -76,18 +76,16 @@ L.TileLayer = L.GridLayer.extend({
 		// Handle start marker
 		this._startMarker = L.marker(new L.LatLng(0, 0), {
 			icon: L.icon({
-				iconUrl: L.Icon.Default.imagePath + '/handle_start.png',
-				iconSize: [30, 44],
-				iconAnchor: [28, 2]
+				className: 'leaflet-selection-marker-start',
+				asDiv: true
 			}),
 			draggable: true
 		});
 		// Handle end marker
 		this._endMarker = L.marker(new L.LatLng(0, 0), {
 			icon: L.icon({
-				iconUrl: L.Icon.Default.imagePath + '/handle_end.png',
-				iconSize: [30, 44],
-				iconAnchor: [2, 2]
+				className: 'leaflet-selection-marker-end',
+				asDiv: true
 			}),
 			draggable: true
 		});


More information about the Libreoffice-commits mailing list