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

Jan Holesovsky kendy at collabora.com
Fri Jan 15 07:26:42 PST 2016


 loleaflet/dist/leaflet.css                    |   92 ++++++++++----------------
 loleaflet/src/control/Control.ColumnHeader.js |   42 +++--------
 loleaflet/src/control/Control.RowHeader.js    |    8 +-
 3 files changed, 53 insertions(+), 89 deletions(-)

New commits:
commit 2d824fe625a5e69ec75802a460a7dbdb786dcc28
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Fri Jan 15 16:25:10 2016 +0100

    loleaflet: Better naming of the spreadsheet header styles.

diff --git a/loleaflet/dist/leaflet.css b/loleaflet/dist/leaflet.css
index 177b937..b02bc70 100644
--- a/loleaflet/dist/leaflet.css
+++ b/loleaflet/dist/leaflet.css
@@ -651,7 +651,7 @@ a.leaflet-control-buttons:hover:first-child {
 	bottom: 20px !important;
 	}
 
-.spreadsheet-corner {
+.spreadsheet-header-corner {
 	border-top: 1px solid darkgrey;
 	border-left: 1px solid darkgrey;
 	border-right: 1px solid darkgrey;
@@ -667,7 +667,7 @@ a.leaflet-control-buttons:hover:first-child {
 	height: 19px;
 	}
 
-.spreadsheet-columns-container {
+.spreadsheet-header-columns-container {
 	border-top: 1px solid darkgrey;
 	border-left: 1px solid darkgrey;
 	border-right: 1px solid darkgrey;
@@ -684,7 +684,7 @@ a.leaflet-control-buttons:hover:first-child {
 	overflow: hidden;
 	}
 
-.spreadsheet-columns {
+.spreadsheet-header-columns {
 	display: inline-block;
 	white-space: nowrap;
 	width: 100%;
@@ -694,7 +694,7 @@ a.leaflet-control-buttons:hover:first-child {
 	padding: 0px;
 	}
 
-.spreadsheet-column {
+.spreadsheet-header-column {
 	border-right: 1px solid darkgrey;
 
 	display: inline-block;
@@ -709,7 +709,7 @@ a.leaflet-control-buttons:hover:first-child {
 	line-height: 100%;
 	}
 
-.spreadsheet-rows-container {
+.spreadsheet-header-rows-container {
 	border-top: 1px solid darkgrey;
 	border-left: 1px solid darkgrey;
 	border-right: 1px solid darkgrey;
@@ -724,7 +724,7 @@ a.leaflet-control-buttons:hover:first-child {
 	overflow: hidden;
 	}
 
-.spreadsheet-rows {
+.spreadsheet-header-rows {
 	width: 100%;
 	height: 100%;
 	border-spacing: 0px !important;
@@ -733,7 +733,7 @@ a.leaflet-control-buttons:hover:first-child {
 	padding: 0px;
 	}
 
-.spreadsheet-row {
+.spreadsheet-header-row {
 	border-bottom: 1px solid darkgrey;
 
 	text-overflow: ellipsis;
diff --git a/loleaflet/src/control/Control.ColumnHeader.js b/loleaflet/src/control/Control.ColumnHeader.js
index 5cd3d82..12238e4 100644
--- a/loleaflet/src/control/Control.ColumnHeader.js
+++ b/loleaflet/src/control/Control.ColumnHeader.js
@@ -15,9 +15,9 @@ L.Control.ColumnHeader = L.Control.extend({
 		this._map.on('updateviewport', this.setViewPort, this);
 		this._map.on('viewrowcolumnheaders', this.viewRowColumnHeaders, this);
 		var docContainer = this._map.options.documentContainer;
-		L.DomUtil.create('div', 'spreadsheet-corner', docContainer.parentElement);
-		var headersContainer = L.DomUtil.create('div', 'spreadsheet-columns-container', docContainer.parentElement);
-		this._columns = L.DomUtil.create('div', 'spreadsheet-columns', headersContainer);
+		L.DomUtil.create('div', 'spreadsheet-header-corner', docContainer.parentElement);
+		var headersContainer = L.DomUtil.create('div', 'spreadsheet-header-columns-container', docContainer.parentElement);
+		this._columns = L.DomUtil.create('div', 'spreadsheet-header-columns', headersContainer);
 
 		this._position = 0;
 		this._totalWidth = 0;
@@ -60,7 +60,7 @@ L.Control.ColumnHeader = L.Control.extend({
 		for (iterator = 0; iterator < columns.length; iterator++) {
 			width = columns[iterator].size - (iterator > 0 ? columns[iterator - 1].size : 0);
 			twip = new L.Point(width, width);
-			text = L.DomUtil.create('div', 'spreadsheet-column', this._columns);
+			text = L.DomUtil.create('div', 'spreadsheet-header-column', this._columns);
 			text.innerHTML = columns[iterator].text;
 			width = Math.round(converter.call(context, twip).x) - 1 + 'px';
 			L.DomUtil.setStyle(text, 'width', width);
diff --git a/loleaflet/src/control/Control.RowHeader.js b/loleaflet/src/control/Control.RowHeader.js
index ef187cf..bca11e5 100644
--- a/loleaflet/src/control/Control.RowHeader.js
+++ b/loleaflet/src/control/Control.RowHeader.js
@@ -15,8 +15,8 @@ L.Control.RowHeader = L.Control.extend({
 		this._map.on('updateviewport', this.setViewPort, this);
 		this._map.on('viewrowcolumnheaders', this.viewRowColumnHeaders, this);
 		var docContainer = this._map.options.documentContainer;
-		var headersContainer = L.DomUtil.create('div', 'spreadsheet-rows-container', docContainer.parentElement);
-		this._rows = L.DomUtil.create('div', 'spreadsheet-rows', headersContainer);
+		var headersContainer = L.DomUtil.create('div', 'spreadsheet-header-rows-container', docContainer.parentElement);
+		this._rows = L.DomUtil.create('div', 'spreadsheet-header-rows', headersContainer);
 
 		this._position = 0;
 		this._totalHeight = 0;
@@ -59,7 +59,7 @@ L.Control.RowHeader = L.Control.extend({
 		for (iterator = 0; iterator < rows.length; iterator++) {
 			height = rows[iterator].size - (iterator > 0 ? rows[iterator - 1].size : 0);
 			twip = new L.Point(height, height);
-			text = L.DomUtil.create('div', 'spreadsheet-row', this._rows);
+			text = L.DomUtil.create('div', 'spreadsheet-header-row', this._rows);
 			text.innerHTML = rows[iterator].text;
 			height = Math.round(converter.call(context, twip).y) - 1 + 'px';
 			L.DomUtil.setStyle(text, 'line-height', height);
commit de93064ed848bda18cef1353c28fdcc02df746c4
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Fri Jan 15 16:24:02 2016 +0100

    loleaflet: Fix off-by-one in the spreadsheet row headers.

diff --git a/loleaflet/src/control/Control.RowHeader.js b/loleaflet/src/control/Control.RowHeader.js
index c853280..ef187cf 100644
--- a/loleaflet/src/control/Control.RowHeader.js
+++ b/loleaflet/src/control/Control.RowHeader.js
@@ -61,7 +61,7 @@ L.Control.RowHeader = L.Control.extend({
 			twip = new L.Point(height, height);
 			text = L.DomUtil.create('div', 'spreadsheet-row', this._rows);
 			text.innerHTML = rows[iterator].text;
-			height = Math.round(converter.call(context, twip).y) - (iterator > 0 ? 1 : 0) + 'px';
+			height = Math.round(converter.call(context, twip).y) - 1 + 'px';
 			L.DomUtil.setStyle(text, 'line-height', height);
 			L.DomUtil.setStyle(text, 'height', height);
 		}
commit c8b4b21523dfd966b1691ccb5f654a05e720a1e7
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Fri Jan 15 16:10:48 2016 +0100

    loleaflet: Simlify & beautify the column headers too.

diff --git a/loleaflet/dist/leaflet.css b/loleaflet/dist/leaflet.css
index ddb5af4..177b937 100644
--- a/loleaflet/dist/leaflet.css
+++ b/loleaflet/dist/leaflet.css
@@ -651,80 +651,62 @@ a.leaflet-control-buttons:hover:first-child {
 	bottom: 20px !important;
 	}
 
-.spreadsheet-container-column {
+.spreadsheet-corner {
+	border-top: 1px solid darkgrey;
+	border-left: 1px solid darkgrey;
+	border-right: 1px solid darkgrey;
+	border-bottom: 1px solid darkgrey;
+	background-color: lightgrey;
+
 	position: absolute;
+	padding: 0px;
+	margin: 0px;
 	left: 0px;
 	top: 80px;
-	width: 100%;
-	height: 20px;
-	margin: 0px;
-	padding: 0px;
+	width: 49px;
+	height: 19px;
 	}
 
-.spreadsheet-container-table {
-	table-layout: fixed;
-	width: 100%;
-	height: 100%;
-	border-spacing: 0px;
-	border-collapse: collapse;
-	border-width: 0px;
-	margin: 0px;
-	padding: 0px;
-	}
+.spreadsheet-columns-container {
+	border-top: 1px solid darkgrey;
+	border-left: 1px solid darkgrey;
+	border-right: 1px solid darkgrey;
+	border-bottom: 1px solid darkgrey;
+	background-color: lightgrey;
 
-.spreadsheet-table-corner {
-	table-layout: fixed;
+	position: absolute;
+	display: inline-block;
+	white-space: nowrap;
+	left: 49px;
+	top: 80px;
 	width: 100%;
-	height: 100%;
-	border-spacing: 0px;
-	margin: 0px;
-	padding: 0px;
-	border: 1px solid black;
-	background-color: darkgrey;
-	}
-
-.spreadsheet-container-th-corner {
-	padding: 0px;
-	margin: 0px;
-	width: 50px;
-	height: 20px;
-	}
-
-.spreadsheet-container-th-column {
-	padding: 0px;
-	margin: 0px;
-	border-width: 0px;
+	height: 19px;
 	overflow: hidden;
 	}
 
-.spreadsheet-table-column {
-	table-layout: fixed;
-	left: 0px;
+.spreadsheet-columns {
+	display: inline-block;
+	white-space: nowrap;
 	width: 100%;
 	height: 100%;
-	border-spacing: 0px;
 	position: relative;
 	margin: 0px;
 	padding: 0px;
 	}
 
-.spreadsheet-table-column-cell {
-	border-left: 0px;
-	border-right: 1px solid black;
-	border-top: 1px solid black;
-	border-bottom: 1px solid black;
-	background-color: darkgrey;
-	overflow: hidden;
-	font-size: 90%;
-	padding: 0px;
-	margin: 0px;
-	}
+.spreadsheet-column {
+	border-right: 1px solid darkgrey;
 
-.spreadsheet-table-column-cell-text {
+	display: inline-block;
+	text-align: center;
+	vertical-align: middle;
 	text-overflow: ellipsis;
 	white-space: nowrap;
 	padding: 0px;
+	padding-top: 4px;
 	margin: 0px;
+	height: 100%;
+	line-height: 100%;
 	}
 
 .spreadsheet-rows-container {
diff --git a/loleaflet/src/control/Control.ColumnHeader.js b/loleaflet/src/control/Control.ColumnHeader.js
index 6cd846f..5cd3d82 100644
--- a/loleaflet/src/control/Control.ColumnHeader.js
+++ b/loleaflet/src/control/Control.ColumnHeader.js
@@ -15,30 +15,19 @@ L.Control.ColumnHeader = L.Control.extend({
 		this._map.on('updateviewport', this.setViewPort, this);
 		this._map.on('viewrowcolumnheaders', this.viewRowColumnHeaders, this);
 		var docContainer = this._map.options.documentContainer;
-		var divHeader = L.DomUtil.create('div', 'spreadsheet-container-column', docContainer.parentElement);
-		var tableContainer =  L.DomUtil.create('table', 'spreadsheet-container-table', divHeader);
-		var trContainer = L.DomUtil.create('tr', '', tableContainer);
-		var thCorner = L.DomUtil.create('th', 'spreadsheet-container-th-corner', trContainer);
-		var tableCorner = L.DomUtil.create('table', 'spreadsheet-table-corner', thCorner);
-		var trCorner = L.DomUtil.create('tr', '', tableCorner);
-		L.DomUtil.create('th', '', trCorner);
-
-		var thColumns = L.DomUtil.create('th', 'spreadsheet-container-th-column', trContainer);
-		this._table = L.DomUtil.create('table', 'spreadsheet-table-column', thColumns);
-		this._columns = L.DomUtil.create('tr', '', this._table);
+		L.DomUtil.create('div', 'spreadsheet-corner', docContainer.parentElement);
+		var headersContainer = L.DomUtil.create('div', 'spreadsheet-columns-container', docContainer.parentElement);
+		this._columns = L.DomUtil.create('div', 'spreadsheet-columns', headersContainer);
 
 		this._position = 0;
 		this._totalWidth = 0;
 		this._viewPort = 0;
-
-		// dummy initial header
-		var dummy = L.DomUtil.create('th', 'spreadsheet-table-column-cell', this._columns);
-		L.DomUtil.create('div', 'spreadsheet-table-column-cell-text', dummy);
 	},
 
 	clearColumns : function () {
-		L.DomUtil.remove(this._columns);
-		this._columns = L.DomUtil.create('tr', '', this._table);
+		while (this._columns.firstChild) {
+			this._columns.removeChild(this._columns.firstChild);
+		}
 	},
 
 	setViewPort: function(e) {
@@ -49,7 +38,7 @@ L.Control.ColumnHeader = L.Control.extend({
 	setScrollPosition: function (e) {
 		var position = -e.x;
 		this._position = Math.min(0, position);
-		L.DomUtil.setStyle(this._table, 'left', this._position + 'px');
+		L.DomUtil.setStyle(this._columns, 'left', this._position + 'px');
 	},
 
 	offsetScrollPosition: function (e) {
@@ -57,7 +46,7 @@ L.Control.ColumnHeader = L.Control.extend({
 		this._position = Math.min(0,
 					  Math.max(this._position - offset,
 						   -(this._totalWidth - this._viewPort)));
-		L.DomUtil.setStyle(this._table, 'left', this._position + 'px');
+		L.DomUtil.setStyle(this._columns, 'left', this._position + 'px');
 	},
 
 	viewRowColumnHeaders: function (e) {
@@ -65,23 +54,16 @@ L.Control.ColumnHeader = L.Control.extend({
 	},
 
 	fillColumns: function (columns, converter, context) {
-		var iterator, twip, width, column, text;
+		var iterator, twip, width, text;
 
 		this.clearColumns();
 		for (iterator = 0; iterator < columns.length; iterator++) {
 			width = columns[iterator].size - (iterator > 0 ? columns[iterator - 1].size : 0);
 			twip = new L.Point(width, width);
-			column = L.DomUtil.create('th', 'spreadsheet-table-column-cell', this._columns);
-			text = L.DomUtil.create('div', 'spreadsheet-table-column-cell-text', column);
+			text = L.DomUtil.create('div', 'spreadsheet-column', this._columns);
 			text.innerHTML = columns[iterator].text;
-			column.width = Math.round(converter.call(context, twip).x) - 1 + 'px';
-		}
-		if (this._map.getDocSize().x < this._map.getSize().x) {
-			// the column headers no longer need to strecth to the whole screen
-			L.DomUtil.setStyle(this._table, 'width', 0);
-		}
-		else {
-			L.DomUtil.setStyle(this._table, 'width', '100%');
+			width = Math.round(converter.call(context, twip).x) - 1 + 'px';
+			L.DomUtil.setStyle(text, 'width', width);
 		}
 	},
 


More information about the Libreoffice-commits mailing list