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

Henry Castro hcastro at collabora.com
Sat Jun 6 15:19:13 PDT 2015


 loleaflet/dist/leaflet.css            |    7 ++++--
 loleaflet/src/layer/marker/Cursor.js  |   35 ++++++----------------------------
 loleaflet/src/layer/tile/TileLayer.js |    8 +++++--
 3 files changed, 18 insertions(+), 32 deletions(-)

New commits:
commit 007ebda88c0bb42f6fc86de3c9bbcfc82209e13c
Author: Henry Castro <hcastro at collabora.com>
Date:   Sat Jun 6 18:17:37 2015 -0400

    Fixed cursor position.

diff --git a/loleaflet/dist/leaflet.css b/loleaflet/dist/leaflet.css
index dbf8e53..346d9e5 100644
--- a/loleaflet/dist/leaflet.css
+++ b/loleaflet/dist/leaflet.css
@@ -555,9 +555,12 @@
 
 }
 
+.leaflet-cursor {
+	position: absolute;
+	text-align: center;
+}
+
 .blinking-cursor {
-  font-weight: 100;
-  font-size: 20px;
   color: #2E3D48;
   -webkit-animation: 1s blink step-end infinite;
   -moz-animation: 1s blink step-end infinite;
diff --git a/loleaflet/src/layer/marker/Cursor.js b/loleaflet/src/layer/marker/Cursor.js
index 3ffce81..d40ffa5 100644
--- a/loleaflet/src/layer/marker/Cursor.js
+++ b/loleaflet/src/layer/marker/Cursor.js
@@ -5,7 +5,6 @@
 L.Cursor = L.Layer.extend({
 
 	options: {
-		zIndexOffset: 0,
 		opacity: 1
 	},
 
@@ -40,11 +39,6 @@ L.Cursor = L.Layer.extend({
 		return this.fire('move', {oldLatLng: oldLatLng, latlng: this._latlng});
 	},
 
-	setZIndexOffset: function (offset) {
-		this.options.zIndexOffset = offset;
-		return this.update();
-	},
-
 	update: function () {
 		if (this._container) {
 			var pos = this._map.latLngToLayerPoint(this._latlng).round();
@@ -54,14 +48,14 @@ L.Cursor = L.Layer.extend({
 	},
 
 	_initLayout: function () {
-		this._container = L.DomUtil.create('div', 'leaflet-popup');
+		this._container = L.DomUtil.create('div', 'leaflet-cursor');
 
 		//<span class="blinking-cursor">|</span>
-		var span = L.DomUtil.create('span', 'blinking-cursor', this._container);
-		span.innerHTML = '|';
+		this._span = L.DomUtil.create('span', 'blinking-cursor', this._container);
+		this._span.innerHTML = '|';
 
 		L.DomEvent
-			.disableClickPropagation(span)
+			.disableClickPropagation(this._span)
 			.disableScrollPropagation(this._container);
 
 		if (this._container) {
@@ -73,18 +67,6 @@ L.Cursor = L.Layer.extend({
 		L.DomUtil.setPosition(this._container, pos);
 
 		this._zIndex = pos.y + this.options.zIndexOffset;
-
-		this._resetZIndex();
-	},
-
-	_updateZIndex: function (offset) {
-		this._icon.style.zIndex = this._zIndex + offset;
-	},
-
-	_animateZoom: function (opt) {
-		var pos = this._map._latLngToNewLayerPoint(this._latlng, opt.zoom, opt.center).round();
-
-		this._setPos(pos);
 	},
 
 	setOpacity: function (opacity) {
@@ -101,12 +83,9 @@ L.Cursor = L.Layer.extend({
 		L.DomUtil.setOpacity(this._container, opacity);
 	},
 
-	_bringToFront: function () {
-		this._updateZIndex(this.options.riseOffset);
-	},
-
-	_resetZIndex: function () {
-		this._updateZIndex(0);
+	setSize: function (size) {
+		this._container.style.lineHeight = size.y + 'px';
+		this._span.style.fontSize = size.y - 2 + 'px';
 	}
 });
 
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index d636ce6..65d8a02 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -707,9 +707,13 @@ L.TileLayer = L.GridLayer.extend({
 			if (this._cursorMarker)
 				this._map.removeLayer(this._cursorMarker);
 
-			var latlngs = L.rectangle(this._cursorBounds).getLatLngs();
-			this._cursorMarker = L.cursor(latlngs[2], {color: 'red'});
+			var pixBounds = L.bounds(this._map.latLngToLayerPoint(this._cursorBounds.getSouthWest()),
+						 this._map.latLngToLayerPoint(this._cursorBounds.getNorthEast()));
+			var latBounds = L.rectangle(this._cursorBounds).getLatLngs();
+
+			this._cursorMarker = L.cursor(latBounds[2], {color: 'red'});
 			this._map.addLayer(this._cursorMarker);
+			this._cursorMarker.setSize(pixBounds.getSize());
 		}
 		else {
 			if (this._cursorMarker)


More information about the Libreoffice-commits mailing list