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

Mihai Varga mihai.varga at collabora.com
Fri Jul 24 08:14:42 PDT 2015


 loleaflet/debug/document/document_simple_example.html |    4 ----
 loleaflet/dist/leaflet.css                            |    3 ++-
 loleaflet/src/control/Control.Parts.js                |   15 ++++++++-------
 3 files changed, 10 insertions(+), 12 deletions(-)

New commits:
commit 53f51a865056cd0c5e0c589033a7f9b26d328ad5
Author: Mihai Varga <mihai.varga at collabora.com>
Date:   Fri Jul 24 18:13:58 2015 +0300

    loleaflet: dynamically create the parts preview and tabs divs

diff --git a/loleaflet/debug/document/document_simple_example.html b/loleaflet/debug/document/document_simple_example.html
index 551137b..90bfdf1 100644
--- a/loleaflet/debug/document/document_simple_example.html
+++ b/loleaflet/debug/document/document_simple_example.html
@@ -34,13 +34,9 @@
     <div id="toolbar" align="center">
         <p style="margin:0px">This space is a placeholder for the future toolbar</p>
     </div>
-    <div id="parts-preview" style="overflow: hidden">
-    </div>
     <div id="document-container" style="top:100px">
         <div id="map"></div>
     </div>
-    <div id="spreadsheet-tab" class="spreadsheet-tab">
-    </div>
 
 	<script>
 
diff --git a/loleaflet/dist/leaflet.css b/loleaflet/dist/leaflet.css
index b577273..ca38896 100644
--- a/loleaflet/dist/leaflet.css
+++ b/loleaflet/dist/leaflet.css
@@ -660,12 +660,13 @@ a.leaflet-control-buttons:hover {
 	padding: 0px;
 }
 
-#parts-preview {
+.parts-preview {
 	background: #DFDFDF;
 	position: absolute;
 	top: 100px;
 	bottom: 0px;
 	max-width: 195px;
+	overflow: hidden;
 }
 
 .preview-frame {
diff --git a/loleaflet/src/control/Control.Parts.js b/loleaflet/src/control/Control.Parts.js
index f8646b6..c789340 100644
--- a/loleaflet/src/control/Control.Parts.js
+++ b/loleaflet/src/control/Control.Parts.js
@@ -24,6 +24,9 @@ L.Control.Parts = L.Control.extend({
 		this._previewTiles = {};
 		this._tabsInitialized = false;
 		this._spreadsheetTabs = {};
+		var docContainer = L.DomUtil.get('document-container');
+		this._partsPreviewCont = L.DomUtil.create('div', 'parts-preview', docContainer.parentElement);
+		this._tabsCont = L.DomUtil.create('div', 'spreadsheet-tab', docContainer.parentElement);
 
 		map.on('updateparts', this._updateDisabled, this);
 		map.on('tilepreview', this._updatePreview, this);
@@ -75,12 +78,11 @@ L.Control.Parts = L.Control.extend({
 			L.DomUtil.setStyle(docContainer, 'left', '200px');
 			setTimeout(L.bind(function () {
 				this._map.invalidateSize();
-				$('#scroll-container').mCustomScrollbar('update');
+				$('.scroll-container').mCustomScrollbar('update');
 			}, this), 500);
-			var container = L.DomUtil.get('parts-preview');
 			for (var i = 0; i < parts; i++) {
 				var id = 'preview-tile' + i;
-				var frame = L.DomUtil.create('div', 'preview-frame', container);
+				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;
@@ -101,12 +103,11 @@ L.Control.Parts = L.Control.extend({
 				L.DomUtil.setStyle(docContainer, 'bottom', '20px');
 				setTimeout(L.bind(function () {
 					this._map.invalidateSize();
-					$('#scroll-container').mCustomScrollbar('update');
+					$('.scroll-container').mCustomScrollbar('update');
 				}, this), 500);
-				container = L.DomUtil.get('spreadsheet-tab');
 				for (i = 0; i < parts; i++) {
 					id = 'spreadsheet-tab' + i;
-					var tab = L.DomUtil.create('li', '', container);
+					var tab = L.DomUtil.create('li', '', this._tabsCont);
 					tab.innerHTML = partNames[i];
 					tab.id = id;
 					L.DomEvent
@@ -140,7 +141,7 @@ L.Control.Parts = L.Control.extend({
 		// the scrollbar has to be re-initialized here else it doesn't work
 		// probably a bug from the scrollbar
 		this._previewTiles[id].onload = function () {
-			$('#parts-preview').mCustomScrollbar({
+			$('.parts-preview').mCustomScrollbar({
 				axis: 'y',
 				theme: 'dark-thick',
 				scrollInertia: 0,


More information about the Libreoffice-commits mailing list