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

Ozcan Esen ozcan.esen at collabora.com
Mon Dec 14 05:31:32 PST 2015


 loleaflet/dist/leaflet.css                    |    9 ++-
 loleaflet/src/control/Control.PartsPreview.js |   62 ++++++++++++++++----------
 2 files changed, 47 insertions(+), 24 deletions(-)

New commits:
commit 449022730bdfe29e7f964cb2cb0e3e05741185d4
Author: Ozcan Esen <ozcan.esen at collabora.com>
Date:   Sat Dec 12 18:27:46 2015 +0200

    change the border style of the selected preview
    
    Change-Id: I0d163c0a68dbc532db08ed8735a4cdb7107ec8e5

diff --git a/loleaflet/dist/leaflet.css b/loleaflet/dist/leaflet.css
index d31be8a..8472eb3 100644
--- a/loleaflet/dist/leaflet.css
+++ b/loleaflet/dist/leaflet.css
@@ -709,13 +709,13 @@ a.leaflet-control-buttons:hover:first-child {
 	top: 70px;
     left: 0px;
 	bottom: 0px;
-	max-width: 195px;
+	max-width: 205px;
 	overflow: hidden;
 	border-top: 2px solid #B6B6B6;
 }
 
 .preview-frame {
-	max-width: 180px;
+	max-width: 190px;
 	white-space: nowrap;
 	text-align: center; margin: 1em 0;
 	}
@@ -730,8 +730,13 @@ a.leaflet-control-buttons:hover:first-child {
 	vertical-align: middle;
 	max-width: 180px;
 	cursor: pointer;
+	border: 2px solid #dfdfdf;
 	}
 
+.preview-img-selected {
+	border-color: #000000;
+}
+
 .spreadsheet-document {
         border-top: 1px solid #B6B6B6 !important;
         top: 100px !important;
diff --git a/loleaflet/src/control/Control.PartsPreview.js b/loleaflet/src/control/Control.PartsPreview.js
index 82aeda3..30989e3 100644
--- a/loleaflet/src/control/Control.PartsPreview.js
+++ b/loleaflet/src/control/Control.PartsPreview.js
@@ -22,34 +22,52 @@ L.Control.PartsPreview = L.Control.extend({
 
 	_updateDisabled: function (e) {
 		var parts = e.parts;
+		var selectedPart = e.selectedPart;
 		var docType = e.docType;
 		if (docType === 'text') {
 			return;
 		}
 
-		if (!this._previewInitialized && docType === 'presentation') {
-			// make room for the preview
-			var docContainer = this._map.options.documentContainer;
-			L.DomUtil.addClass(docContainer, 'parts-preview-document');
-			setTimeout(L.bind(function () {
-				this._map.invalidateSize();
-				$('.scroll-container').mCustomScrollbar('update');
-			}, this), 500);
-			for (var i = 0; i < parts; i++) {
-				var id = 'preview-tile' + i;
-				var frame = L.DomUtil.create('div', 'preview-frame', this._partsPreviewCont);
-				L.DomUtil.create('span', 'preview-helper', frame);
-				var img = L.DomUtil.create('img', 'preview-img', frame);
-				img.id = id;
-				this._previewTiles[id] = img;
-				L.DomEvent
-					.on(img, 'click', L.DomEvent.stopPropagation)
-					.on(img, 'click', L.DomEvent.stop)
-					.on(img, 'click', this._setPart, this)
-					.on(img, 'click', this._refocusOnMap, this);
-				this._map.getPreview(i, i, 180, 180, {autoUpdate: this.options.autoUpdate});
+		if (docType === 'presentation') {
+			if (!this._previewInitialized)
+			{
+				// make room for the preview
+				var docContainer = this._map.options.documentContainer;
+				L.DomUtil.addClass(docContainer, 'parts-preview-document');
+				setTimeout(L.bind(function () {
+					this._map.invalidateSize();
+					$('.scroll-container').mCustomScrollbar('update');
+				}, this), 500);
+				for (var i = 0; i < parts; i++) {
+					var id = 'preview-tile' + i;
+					var frame = L.DomUtil.create('div', 'preview-frame', this._partsPreviewCont);
+					L.DomUtil.create('span', 'preview-helper', frame);
+					var imgClassName = 'preview-img';
+					if (i == 0) {
+						imgClassName += ' preview-img-selected';
+					}
+					var img = L.DomUtil.create('img', imgClassName, frame);
+					img.id = id;
+					this._previewTiles[id] = img;
+					L.DomEvent
+						.on(img, 'click', L.DomEvent.stopPropagation)
+						.on(img, 'click', L.DomEvent.stop)
+						.on(img, 'click', this._setPart, this)
+						.on(img, 'click', this._refocusOnMap, this);
+					this._map.getPreview(i, i, 180, 180, {autoUpdate: this.options.autoUpdate});
+				}
+				this._previewInitialized = true;
+			}
+			else
+			{
+				// change the border style of the selected preview.
+				for (var i = 0; i < parts; i++) {
+					var img = L.DomUtil.get('preview-tile' + i);
+					L.DomUtil.removeClass(img, 'preview-img-selected');
+				}
+				var img = L.DomUtil.get('preview-tile' + selectedPart);
+				L.DomUtil.addClass(img, 'preview-img-selected');
 			}
-			this._previewInitialized = true;
 		}
 	},
 


More information about the Libreoffice-commits mailing list