[Libreoffice-commits] online.git: loleaflet/dist loleaflet/src
Jan Holesovsky
kendy at collabora.com
Fri Jan 15 05:44:45 PST 2016
loleaflet/dist/leaflet.css | 34 ++++++++++++-----------------
loleaflet/src/control/Control.RowHeader.js | 34 ++++++++---------------------
2 files changed, 25 insertions(+), 43 deletions(-)
New commits:
commit a29a9d37d63ae16f5246eaafba03d5bd676324e2
Author: Jan Holesovsky <kendy at collabora.com>
Date: Fri Jan 15 14:38:48 2016 +0100
loleaflet: Simlify & beautify the row headers.
diff --git a/loleaflet/dist/leaflet.css b/loleaflet/dist/leaflet.css
index 858809f..ddb5af4 100644
--- a/loleaflet/dist/leaflet.css
+++ b/loleaflet/dist/leaflet.css
@@ -727,25 +727,22 @@ a.leaflet-control-buttons:hover:first-child {
margin: 0px;
}
-.spreadsheet-table-row-cell-text {
- text-overflow: ellipsis;
- white-space: nowrap;
- padding: 0px;
- margin: 0px;
- height: 100%;
- }
+.spreadsheet-rows-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-container-row {
position: absolute;
left: 0;
top: 100px;
- width: 50px;
+ width: 48px;
bottom: 20px;
overflow: hidden;
}
-.spreadsheet-table-row {
- table-layout: fixed;
+.spreadsheet-rows {
width: 100%;
height: 100%;
border-spacing: 0px !important;
@@ -754,16 +751,15 @@ a.leaflet-control-buttons:hover:first-child {
padding: 0px;
}
-.spreadsheet-table-row-cell {
- border-top: 0px;
- border-left: 1px solid black;
- border-right: 1px solid black;
- border-bottom: 1px solid black;
- background-color: darkgrey;
- font-size: 90%;
+.spreadsheet-row {
+ border-bottom: 1px solid darkgrey;
+
+ text-overflow: ellipsis;
+ white-space: nowrap;
padding: 0px;
+ padding-left: 8px;
margin: 0px;
- overflow: hidden;
+ height: 100%;
}
.slide-show {
diff --git a/loleaflet/src/control/Control.RowHeader.js b/loleaflet/src/control/Control.RowHeader.js
index 2aef1da..c853280 100644
--- a/loleaflet/src/control/Control.RowHeader.js
+++ b/loleaflet/src/control/Control.RowHeader.js
@@ -15,23 +15,18 @@ 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 divRowHeader = L.DomUtil.create('div', 'spreadsheet-container-row', docContainer.parentElement);
- this._table = L.DomUtil.create('table', 'spreadsheet-table-row', divRowHeader);
- this._rows = L.DomUtil.create('tbody', '', this._table);
+ var headersContainer = L.DomUtil.create('div', 'spreadsheet-rows-container', docContainer.parentElement);
+ this._rows = L.DomUtil.create('div', 'spreadsheet-rows', headersContainer);
this._position = 0;
this._totalHeight = 0;
this._viewPort = 0;
-
- // dummy initial row header
- var trRow = L.DomUtil.create('tr', '', this._rows);
- var thRow = L.DomUtil.create('th', 'spreadsheet-table-row-cell', trRow);
- L.DomUtil.create('div', 'spreadsheet-table-row-cell-text', thRow);
},
clearRows: function () {
- L.DomUtil.remove(this._rows);
- this._rows = L.DomUtil.create('tbody', '', this._table);
+ while (this._rows.firstChild) {
+ this._rows.removeChild(this._rows.firstChild);
+ }
},
setViewPort: function(e) {
@@ -42,7 +37,7 @@ L.Control.RowHeader = L.Control.extend({
setScrollPosition: function (e) {
var position = -e.y;
this._position = Math.min(0, position);
- L.DomUtil.setStyle(this._table, 'top', this._position + 'px');
+ L.DomUtil.setStyle(this._rows, 'top', this._position + 'px');
},
offsetScrollPosition: function (e) {
@@ -50,7 +45,7 @@ L.Control.RowHeader = L.Control.extend({
this._position = Math.min(0,
Math.max(this._position - offset,
-(this._totalHeight - this._viewPort)));
- L.DomUtil.setStyle(this._table, 'top', this._position + 'px');
+ L.DomUtil.setStyle(this._rows, 'top', this._position + 'px');
},
viewRowColumnHeaders: function (e) {
@@ -58,27 +53,18 @@ L.Control.RowHeader = L.Control.extend({
},
fillRows: function (rows, converter, context) {
- var iterator, twip, height, row, cell, text;
+ var iterator, twip, height, text;
this.clearRows();
for (iterator = 0; iterator < rows.length; iterator++) {
height = rows[iterator].size - (iterator > 0 ? rows[iterator - 1].size : 0);
twip = new L.Point(height, height);
- row = L.DomUtil.create('tr', '', this._rows);
- cell = L.DomUtil.create('th', 'spreadsheet-table-row-cell', row);
- text = L.DomUtil.create('div', 'spreadsheet-table-row-cell-text', cell);
- text.innerHTML = rows[iterator].text;
+ 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';
L.DomUtil.setStyle(text, 'line-height', height);
L.DomUtil.setStyle(text, 'height', height);
}
- if (this._map.getDocSize().y < this._map.getSize().y) {
- // the row headers no longer need to strecth to the whole screen
- L.DomUtil.setStyle(this._table, 'height', 0);
- }
- else {
- L.DomUtil.setStyle(this._table, 'height', '100%');
- }
},
_onUpdatePermission: function () {
More information about the Libreoffice-commits
mailing list