[Libreoffice-commits] online.git: 6 commits - loleaflet/build loleaflet/debug loleaflet/src
Mihai Varga
mihai.varga at collabora.com
Fri Dec 11 04:52:44 PST 2015
loleaflet/build/deps.js | 26 +-
loleaflet/debug/document/document_simple_example.html | 4
loleaflet/src/control/Control.ColumnHeader.js | 168 ++++++++++--------
loleaflet/src/control/Control.PartsPreview.js | 4
loleaflet/src/control/Control.RowHeader.js | 141 +++++++++------
loleaflet/src/control/Control.Tabs.js | 4
loleaflet/src/layer/tile/CalcTileLayer.js | 57 ++----
loleaflet/src/layer/tile/TileLayer.js | 2
loleaflet/src/map/Map.js | 5
9 files changed, 229 insertions(+), 182 deletions(-)
New commits:
commit 152ad884e26e030ffa364bfc6ef07e48dad1329b
Author: Mihai Varga <mihai.varga at collabora.com>
Date: Fri Dec 11 14:50:07 2015 +0200
Revert "loleaflet: Change !(... >= 0) to ... < 0 for readability."
This reverts commit 00d7ab35195b437c54cc9359dac8f830f5b98471.
_currentPage can also be undefined so in that case
!(this._currentPage >= 0) will be evaluated to true
while
this._currentPage < 0 will be false (as it should be)
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index 30afa3e..d68df14 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -949,7 +949,7 @@ L.TileLayer = L.GridLayer.extend({
_onCurrentPageUpdate: function () {
var mapCenter = this._map.project(this._map.getCenter());
- if (!this._partPageRectanglesPixels || this._currentPage < 0 || this._currentPage >= this._partPageRectanglesPixels.length ||
+ if (!this._partPageRectanglesPixels || !(this._currentPage >= 0) || this._currentPage >= this._partPageRectanglesPixels.length ||
this._partPageRectanglesPixels[this._currentPage].contains(mapCenter)) {
// page number has not changed
return;
commit 35a505d35e37c4fa5578fec9d66ce4ced140a7a5
Author: Mihai Varga <mihai.varga at collabora.com>
Date: Fri Dec 11 14:45:04 2015 +0200
loleaflet: allow specifing the document container as a map option
diff --git a/loleaflet/debug/document/document_simple_example.html b/loleaflet/debug/document/document_simple_example.html
index e69dc82..34352ae 100644
--- a/loleaflet/debug/document/document_simple_example.html
+++ b/loleaflet/debug/document/document_simple_example.html
@@ -70,6 +70,7 @@
server: host,
edit: edit,
timestamp: timestamp,
+ documentContainer: 'document-container',
readOnly: false
});
diff --git a/loleaflet/src/control/Control.ColumnHeader.js b/loleaflet/src/control/Control.ColumnHeader.js
index 9a9d3f6..21d3215 100644
--- a/loleaflet/src/control/Control.ColumnHeader.js
+++ b/loleaflet/src/control/Control.ColumnHeader.js
@@ -15,7 +15,7 @@ L.Control.ColumnHeader = L.Control.extend({
this._map.on('updatescrolloffset', this.setScrollPosition, this);
this._map.on('updateviewport', this.setViewPort, this);
this._map.on('viewrowcolumnheaders', this.viewRowColumnHeaders, this);
- var docContainer = L.DomUtil.get('document-container');
+ 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);
diff --git a/loleaflet/src/control/Control.PartsPreview.js b/loleaflet/src/control/Control.PartsPreview.js
index 51aaff7..82aeda3 100644
--- a/loleaflet/src/control/Control.PartsPreview.js
+++ b/loleaflet/src/control/Control.PartsPreview.js
@@ -11,7 +11,7 @@ L.Control.PartsPreview = L.Control.extend({
onAdd: function (map) {
this._previewInitialized = false;
this._previewTiles = {};
- var docContainer = L.DomUtil.get('document-container');
+ var docContainer = map.options.documentContainer;
this._partsPreviewCont = L.DomUtil.create('div', 'parts-preview', docContainer.parentElement);
map.on('updateparts', this._updateDisabled, this);
@@ -29,7 +29,7 @@ L.Control.PartsPreview = L.Control.extend({
if (!this._previewInitialized && docType === 'presentation') {
// make room for the preview
- var docContainer = L.DomUtil.get('document-container');
+ var docContainer = this._map.options.documentContainer;
L.DomUtil.addClass(docContainer, 'parts-preview-document');
setTimeout(L.bind(function () {
this._map.invalidateSize();
diff --git a/loleaflet/src/control/Control.RowHeader.js b/loleaflet/src/control/Control.RowHeader.js
index 335741a..2085da2 100644
--- a/loleaflet/src/control/Control.RowHeader.js
+++ b/loleaflet/src/control/Control.RowHeader.js
@@ -15,7 +15,7 @@ L.Control.RowHeader = L.Control.extend({
this._map.on('updatescrolloffset', this.setScrollPosition, this);
this._map.on('updateviewport', this.setViewPort, this);
this._map.on('viewrowcolumnheaders', this.viewRowColumnHeaders, this);
- var docContainer = L.DomUtil.get('document-container');
+ 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);
diff --git a/loleaflet/src/control/Control.Tabs.js b/loleaflet/src/control/Control.Tabs.js
index 8ab6887..576408b 100644
--- a/loleaflet/src/control/Control.Tabs.js
+++ b/loleaflet/src/control/Control.Tabs.js
@@ -7,7 +7,7 @@ L.Control.Tabs = L.Control.extend({
onAdd: function (map) {
this._tabsInitialized = false;
this._spreadsheetTabs = {};
- var docContainer = L.DomUtil.get('document-container');
+ var docContainer = map.options.documentContainer;
this._tabsCont = L.DomUtil.create('div', 'spreadsheet-tab', docContainer.parentElement);
map.on('updateparts', this._updateDisabled, this);
@@ -25,7 +25,7 @@ L.Control.Tabs = L.Control.extend({
if (docType === 'spreadsheet') {
if (!this._tabsInitialized) {
// make room for the preview
- var docContainer = L.DomUtil.get('document-container');
+ var docContainer = this._map.options.documentContainer;
L.DomUtil.addClass(docContainer, 'spreadsheet-document');
setTimeout(L.bind(function () {
this._map.invalidateSize();
diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index 7dd0ce5..1f8042e 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -20,6 +20,11 @@ L.Map = L.Evented.extend({
initialize: function (id, options) { // (HTMLElement or String, Object)
options = L.setOptions(this, options);
+ if (this.options.documentContainer) {
+ // have it as DOM object
+ this.options.documentContainer = L.DomUtil.get(this.options.documentContainer);
+ }
+
this._initContainer(id);
this._initLayout();
commit 7f36d5be8af6866c59480c05d05129f4395e4c77
Author: Mihai Varga <mihai.varga at collabora.com>
Date: Fri Dec 11 14:04:58 2015 +0200
loleaflet: refactor the row column header
Now it works as a detachable control
diff --git a/loleaflet/debug/document/document_simple_example.html b/loleaflet/debug/document/document_simple_example.html
index 35a586f..e69dc82 100644
--- a/loleaflet/debug/document/document_simple_example.html
+++ b/loleaflet/debug/document/document_simple_example.html
@@ -87,5 +87,7 @@
globalMap.addControl(L.control.dialog());
globalMap.addControl(L.control.partsPreview());
globalMap.addControl(L.control.tabs());
+ globalMap.addControl(L.control.columnHeader());
+ globalMap.addControl(L.control.rowHeader());
</script>
</body></html>
diff --git a/loleaflet/src/control/Control.ColumnHeader.js b/loleaflet/src/control/Control.ColumnHeader.js
index b5ec373..9a9d3f6 100644
--- a/loleaflet/src/control/Control.ColumnHeader.js
+++ b/loleaflet/src/control/Control.ColumnHeader.js
@@ -3,7 +3,18 @@
*/
L.Control.ColumnHeader = L.Control.extend({
- onAdd: function () {
+ onAdd: function (map) {
+ map.on('updatepermission', this._onUpdatePermission, this);
+ this._initialized = false;
+ return document.createElement('div');
+ },
+
+ _initialize: function () {
+ this._initialized = true;
+ this._map.on('scrolloffset', this.offsetScrollPosition, this);
+ this._map.on('updatescrolloffset', this.setScrollPosition, this);
+ this._map.on('updateviewport', this.setViewPort, this);
+ this._map.on('viewrowcolumnheaders', this.viewRowColumnHeaders, this);
var docContainer = L.DomUtil.get('document-container');
var divHeader = L.DomUtil.create('div', 'spreadsheet-container-column', docContainer.parentElement);
var tableContainer = L.DomUtil.create('table', 'spreadsheet-container-table', divHeader);
@@ -24,8 +35,6 @@ L.Control.ColumnHeader = L.Control.extend({
// 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);
-
- return document.createElement('div');
},
clearColumns : function () {
@@ -33,23 +42,34 @@ L.Control.ColumnHeader = L.Control.extend({
this._columns = L.DomUtil.create('tr', '', this._table);
},
- setViewPort: function(totalWidth, viewPort) {
- this._viewPort = viewPort;
- this._totalWidth = totalWidth;
+ setViewPort: function(e) {
+ this._viewPort = e.columns.viewPort;
+ this._totalWidth = e.columns.totalWidth;
},
- setScrollPosition: function (position) {
+ setScrollPosition: function (e) {
+ var position = -e.x;
this._position = Math.min(0, position);
L.DomUtil.setStyle(this._table, 'left', this._position + 'px');
},
- offsetScrollPosition: function (offset) {
+ offsetScrollPosition: function (e) {
+ var offset = e.x;
this._position = Math.min(0,
Math.max(this._position - offset,
- -(this._totalWidth - this._viewPort - 4)));
+ -(this._totalWidth - this._viewPort)));
L.DomUtil.setStyle(this._table, 'left', this._position + 'px');
},
+ viewRowColumnHeaders: function (e) {
+ if (e.isZoomed) {
+ this.updateColumns(e.data.columns, e.converter, e.context);
+ }
+ else {
+ this.fillColumns(e.data.columns, e.converter, e.context);
+ }
+ },
+
fillColumns: function (columns, converter, context) {
var iterator, twip, width, column, text;
@@ -73,6 +93,12 @@ L.Control.ColumnHeader = L.Control.extend({
twip = new L.Point(width, width);
column.width = Math.round(converter.call(context, twip).x) - 1 + 'px';
}
+ },
+
+ _onUpdatePermission: function () {
+ if (this._map.getDocType() === 'spreadsheet' && !this._initialized) {
+ this._initialize();
+ }
}
});
diff --git a/loleaflet/src/control/Control.RowHeader.js b/loleaflet/src/control/Control.RowHeader.js
index 50d6e0b..335741a 100644
--- a/loleaflet/src/control/Control.RowHeader.js
+++ b/loleaflet/src/control/Control.RowHeader.js
@@ -3,7 +3,18 @@
*/
L.Control.RowHeader = L.Control.extend({
- onAdd: function () {
+ onAdd: function (map) {
+ map.on('updatepermission', this._onUpdatePermission, this);
+ this._initialized = false;
+ return document.createElement('div');
+ },
+
+ _initialize: function () {
+ this._initialized = true;
+ this._map.on('scrolloffset', this.offsetScrollPosition, this);
+ this._map.on('updatescrolloffset', this.setScrollPosition, this);
+ this._map.on('updateviewport', this.setViewPort, this);
+ this._map.on('viewrowcolumnheaders', this.viewRowColumnHeaders, this);
var docContainer = L.DomUtil.get('document-container');
var divRowHeader = L.DomUtil.create('div', 'spreadsheet-container-row', docContainer.parentElement);
this._table = L.DomUtil.create('table', 'spreadsheet-table-row', divRowHeader);
@@ -17,8 +28,6 @@ L.Control.RowHeader = L.Control.extend({
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);
-
- return document.createElement('div');
},
clearRows: function () {
@@ -26,23 +35,35 @@ L.Control.RowHeader = L.Control.extend({
this._rows = L.DomUtil.create('tbody', '', this._table);
},
- setViewPort: function(totalHeight, viewPort) {
- this._viewPort = viewPort;
- this._totalHeight = totalHeight;
+ setViewPort: function(e) {
+ this._viewPort = e.rows.viewPort;
+ this._totalHeight = e.rows.totalHeight;
},
- setScrollPosition: function (position) {
+ setScrollPosition: function (e) {
+ var position = -e.y;
this._position = Math.min(0, position);
L.DomUtil.setStyle(this._table, 'top', this._position + 'px');
},
- offsetScrollPosition: function (offset) {
+ offsetScrollPosition: function (e) {
+ var offset = e.y;
this._position = Math.min(0,
Math.max(this._position - offset,
- -(this._totalHeight - this._viewPort - 4)));
+ -(this._totalHeight - this._viewPort)));
L.DomUtil.setStyle(this._table, 'top', this._position + 'px');
},
+ viewRowColumnHeaders: function (e) {
+ if (e.isZoomed) {
+ this.updateRows(e.data.rows, e.converter, e.context);
+ }
+ else {
+ this.fillRows(e.data.rows, e.converter, e.context);
+ }
+ this._map._docLayer._isZoomed = false;
+ },
+
fillRows: function (rows, converter, context) {
var iterator, twip, height, row, cell, text;
@@ -71,6 +92,12 @@ L.Control.RowHeader = L.Control.extend({
L.DomUtil.setStyle(text, 'line-height', height);
L.DomUtil.setStyle(text, 'height', height);
}
+ },
+
+ _onUpdatePermission: function () {
+ if (this._map.getDocType() === 'spreadsheet' && !this._initialized) {
+ this._initialize();
+ }
}
});
diff --git a/loleaflet/src/layer/tile/CalcTileLayer.js b/loleaflet/src/layer/tile/CalcTileLayer.js
index c951264..4146ac8 100644
--- a/loleaflet/src/layer/tile/CalcTileLayer.js
+++ b/loleaflet/src/layer/tile/CalcTileLayer.js
@@ -6,12 +6,6 @@ L.CalcTileLayer = L.TileLayer.extend({
beforeAdd: function (map) {
map._addZoomLimit(this);
- this._columns = L.control.columnHeader();
- this._rows = L.control.rowHeader();
- map.addControl(this._columns);
- map.addControl(this._rows);
- map.on('scrolloffset', this._onScrollOffset, this);
- map.on('updatescrolloffset', this._onUpdateScrollOffset, this);
map.on('zoomend', this._onZoomRowColumns, this);
map.on('resize', this._onUpdateViewPort, this);
},
@@ -112,17 +106,8 @@ L.CalcTileLayer = L.TileLayer.extend({
}
},
- _onScrollOffset: function(offset) {
- this._columns.offsetScrollPosition(offset.x);
- this._rows.offsetScrollPosition(offset.y);
- },
-
- _onUpdateScrollOffset: function (e) {
- this._columns.setScrollPosition(-e.x);
- this._rows.setScrollPosition(-e.y);
- },
-
_onZoomRowColumns: function () {
+ // TODO we need to cache those, so that we don't spawn a LOK instance unnecessarily
this._isZoomend = true;
this._updateClientZoom();
if (this._clientZoom) {
@@ -135,15 +120,18 @@ L.CalcTileLayer = L.TileLayer.extend({
_onUpdateViewPort: function () {
// sadly I don't know what this number 4 is, but without it, it does not work
// TODO fix it
- var offset = 4;
- var width = parseInt(L.DomUtil.getStyle(this._map._container, 'width')) - offset;
- if (!isNaN(width)) {
- this._columns.setViewPort(this._docPixelSize.x, width);
- }
- var height = parseInt(L.DomUtil.getStyle(this._map._container, 'height')) - offset;
- if (!isNaN(height)) {
- this._rows.setViewPort(this._docPixelSize.y, height);
- }
+ var width = parseInt(L.DomUtil.getStyle(this._map._container, 'width'));
+ var height = parseInt(L.DomUtil.getStyle(this._map._container, 'height'));
+ this._map.fire('updateviewport', {
+ rows: {
+ totalHeight: this._docPixelSize.y,
+ viewPort: height
+ },
+ columns: {
+ totalWidth: this._docPixelSize.x,
+ viewPort: width
+ }
+ });
},
_onStatusMsg: function (textMsg) {
@@ -181,15 +169,12 @@ L.CalcTileLayer = L.TileLayer.extend({
_onCommandValuesMsg: function (textMsg) {
if (textMsg.match('.uno:ViewRowColumnHeaders')) {
var data = JSON.parse(textMsg.substring(textMsg.indexOf('{')));
- if (this._isZoomend) {
- this._columns.updateColumns(data.columns, this._twipsToPixels, this);
- this._rows.updateRows(data.rows, this._twipsToPixels, this);
- this._isZoomend = false;
- }
- else {
- this._columns.fillColumns(data.columns, this._twipsToPixels, this);
- this._rows.fillRows(data.rows, this._twipsToPixels, this);
- }
+ this._map.fire('viewrowcolumnheaders', {
+ data: data,
+ converter: this._twipsToPixels,
+ context: this,
+ isZoomed: this._isZoomed
+ });
this._onUpdateViewPort();
}
else {
commit 3f7de82ef900a208efce8be44cedf080d5aa2ae3
Author: Mihai Varga <mihai.varga at collabora.com>
Date: Fri Dec 11 12:31:33 2015 +0200
loleaflet: don't reference our scrollbars
diff --git a/loleaflet/src/layer/tile/CalcTileLayer.js b/loleaflet/src/layer/tile/CalcTileLayer.js
index c14bb19..c951264 100644
--- a/loleaflet/src/layer/tile/CalcTileLayer.js
+++ b/loleaflet/src/layer/tile/CalcTileLayer.js
@@ -133,13 +133,14 @@ L.CalcTileLayer = L.TileLayer.extend({
},
_onUpdateViewPort: function () {
- var hscroll = L.DomUtil.get('mCSB_1_scrollbar_horizontal');
- var width = parseInt(L.DomUtil.getStyle(hscroll, 'width'));
+ // sadly I don't know what this number 4 is, but without it, it does not work
+ // TODO fix it
+ var offset = 4;
+ var width = parseInt(L.DomUtil.getStyle(this._map._container, 'width')) - offset;
if (!isNaN(width)) {
this._columns.setViewPort(this._docPixelSize.x, width);
}
- var vscroll = L.DomUtil.get('mCSB_1_scrollbar_vertical');
- var height = parseInt(L.DomUtil.getStyle(vscroll, 'height'));
+ var height = parseInt(L.DomUtil.getStyle(this._map._container, 'height')) - offset;
if (!isNaN(height)) {
this._rows.setViewPort(this._docPixelSize.y, height);
}
commit 2d883a2dbecda80ada1e39ec7121afc822a223bc
Author: Mihai Varga <mihai.varga at collabora.com>
Date: Fri Dec 11 12:09:32 2015 +0200
loleaflet: fixed indentation
diff --git a/loleaflet/build/deps.js b/loleaflet/build/deps.js
index 9f433ac..1cc21bf 100644
--- a/loleaflet/build/deps.js
+++ b/loleaflet/build/deps.js
@@ -282,19 +282,19 @@ var deps = {
desc: 'Parts preview sidebar'
},
- ControlColumnHeader: {
- src: ['control/Control.js',
- 'control/Control.ColumnHeader.js'],
- heading: 'Controls',
- desc: 'Column Header bar'
- },
-
- ControlRowHeader: {
- src: ['control/Control.js',
- 'control/Control.RowHeader.js'],
- heading: 'Controls',
- desc: 'Row Header bar'
- },
+ ControlColumnHeader: {
+ src: ['control/Control.js',
+ 'control/Control.ColumnHeader.js'],
+ heading: 'Controls',
+ desc: 'Column Header bar'
+ },
+
+ ControlRowHeader: {
+ src: ['control/Control.js',
+ 'control/Control.RowHeader.js'],
+ heading: 'Controls',
+ desc: 'Row Header bar'
+ },
ControlTabs: {
src: ['control/Control.js',
diff --git a/loleaflet/src/control/Control.ColumnHeader.js b/loleaflet/src/control/Control.ColumnHeader.js
index 17d9082..b5ec373 100644
--- a/loleaflet/src/control/Control.ColumnHeader.js
+++ b/loleaflet/src/control/Control.ColumnHeader.js
@@ -3,77 +3,77 @@
*/
L.Control.ColumnHeader = L.Control.extend({
- onAdd: function () {
- var docContainer = L.DomUtil.get('document-container');
- 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);
+ onAdd: function () {
+ var docContainer = L.DomUtil.get('document-container');
+ 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);
+ 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);
- this._position = 0;
- this._totalWidth = 0;
- this._viewPort = 0;
+ 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);
+ // 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);
- return document.createElement('div');
- },
+ return document.createElement('div');
+ },
- clearColumns : function () {
- L.DomUtil.remove(this._columns);
- this._columns = L.DomUtil.create('tr', '', this._table);
- },
+ clearColumns : function () {
+ L.DomUtil.remove(this._columns);
+ this._columns = L.DomUtil.create('tr', '', this._table);
+ },
- setViewPort: function(totalWidth, viewPort) {
- this._viewPort = viewPort;
- this._totalWidth = totalWidth;
- },
+ setViewPort: function(totalWidth, viewPort) {
+ this._viewPort = viewPort;
+ this._totalWidth = totalWidth;
+ },
- setScrollPosition: function (position) {
- this._position = Math.min(0, position);
- L.DomUtil.setStyle(this._table, 'left', this._position + 'px');
- },
+ setScrollPosition: function (position) {
+ this._position = Math.min(0, position);
+ L.DomUtil.setStyle(this._table, 'left', this._position + 'px');
+ },
- offsetScrollPosition: function (offset) {
- this._position = Math.min(0,
- Math.max(this._position - offset,
- -(this._totalWidth - this._viewPort - 4)));
- L.DomUtil.setStyle(this._table, 'left', this._position + 'px');
- },
+ offsetScrollPosition: function (offset) {
+ this._position = Math.min(0,
+ Math.max(this._position - offset,
+ -(this._totalWidth - this._viewPort - 4)));
+ L.DomUtil.setStyle(this._table, 'left', this._position + 'px');
+ },
- fillColumns: function (columns, converter, context) {
- var iterator, twip, width, column, text;
+ fillColumns: function (columns, converter, context) {
+ var iterator, twip, width, column, 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.innerHTML = columns[iterator].text;
- column.width = Math.round(converter.call(context, twip).x) - 1 + 'px';
- }
- },
+ 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.innerHTML = columns[iterator].text;
+ column.width = Math.round(converter.call(context, twip).x) - 1 + 'px';
+ }
+ },
- updateColumns: function (columns, converter, context) {
- var iterator, twip, width, column;
+ updateColumns: function (columns, converter, context) {
+ var iterator, twip, width, column;
- for (iterator = 0; iterator < this._columns.childNodes.length; iterator++) {
- column = this._columns.childNodes[iterator];
- width = columns[iterator].size - (iterator > 0 ? columns[iterator - 1].size : 0);
- twip = new L.Point(width, width);
- column.width = Math.round(converter.call(context, twip).x) - 1 + 'px';
- }
- }
+ for (iterator = 0; iterator < this._columns.childNodes.length; iterator++) {
+ column = this._columns.childNodes[iterator];
+ width = columns[iterator].size - (iterator > 0 ? columns[iterator - 1].size : 0);
+ twip = new L.Point(width, width);
+ column.width = Math.round(converter.call(context, twip).x) - 1 + 'px';
+ }
+ }
});
L.control.columnHeader = function (options) {
diff --git a/loleaflet/src/control/Control.RowHeader.js b/loleaflet/src/control/Control.RowHeader.js
index c4fab2a..50d6e0b 100644
--- a/loleaflet/src/control/Control.RowHeader.js
+++ b/loleaflet/src/control/Control.RowHeader.js
@@ -3,75 +3,75 @@
*/
L.Control.RowHeader = L.Control.extend({
- onAdd: function () {
- var docContainer = L.DomUtil.get('document-container');
- 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);
+ onAdd: function () {
+ var docContainer = L.DomUtil.get('document-container');
+ 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);
- this._position = 0;
- this._totalHeight = 0;
- this._viewPort = 0;
+ 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);
+ // 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);
- return document.createElement('div');
- },
+ return document.createElement('div');
+ },
- clearRows: function () {
- L.DomUtil.remove(this._rows);
- this._rows = L.DomUtil.create('tbody', '', this._table);
- },
+ clearRows: function () {
+ L.DomUtil.remove(this._rows);
+ this._rows = L.DomUtil.create('tbody', '', this._table);
+ },
- setViewPort: function(totalHeight, viewPort) {
- this._viewPort = viewPort;
- this._totalHeight = totalHeight;
- },
+ setViewPort: function(totalHeight, viewPort) {
+ this._viewPort = viewPort;
+ this._totalHeight = totalHeight;
+ },
- setScrollPosition: function (position) {
- this._position = Math.min(0, position);
- L.DomUtil.setStyle(this._table, 'top', this._position + 'px');
- },
+ setScrollPosition: function (position) {
+ this._position = Math.min(0, position);
+ L.DomUtil.setStyle(this._table, 'top', this._position + 'px');
+ },
- offsetScrollPosition: function (offset) {
- this._position = Math.min(0,
- Math.max(this._position - offset,
- -(this._totalHeight - this._viewPort - 4)));
- L.DomUtil.setStyle(this._table, 'top', this._position + 'px');
- },
+ offsetScrollPosition: function (offset) {
+ this._position = Math.min(0,
+ Math.max(this._position - offset,
+ -(this._totalHeight - this._viewPort - 4)));
+ L.DomUtil.setStyle(this._table, 'top', this._position + 'px');
+ },
- fillRows: function (rows, converter, context) {
- var iterator, twip, height, row, cell, text;
+ fillRows: function (rows, converter, context) {
+ var iterator, twip, height, row, cell, 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;
- 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);
- }
- },
+ 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;
+ 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);
+ }
+ },
- updateRows: function (rows, converter, context) {
- var iterator, twip, height, text;
+ updateRows: function (rows, converter, context) {
+ var iterator, twip, height, text;
- for (iterator = 0; iterator < this._rows.childNodes.length; iterator++) {
- text = this._rows.childNodes[iterator].firstChild.firstChild;
- height = rows[iterator].size - (iterator > 0 ? rows[iterator - 1].size : 0);
- twip = new L.Point(height, height);
- 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);
+ for (iterator = 0; iterator < this._rows.childNodes.length; iterator++) {
+ text = this._rows.childNodes[iterator].firstChild.firstChild;
+ height = rows[iterator].size - (iterator > 0 ? rows[iterator - 1].size : 0);
+ twip = new L.Point(height, height);
+ 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);
+ }
}
- }
});
L.control.rowHeader = function (options) {
commit 3b2ee2c0ac658e105359b12ed57d581c8fe938d4
Author: Mihai Varga <mihai.varga at collabora.com>
Date: Fri Dec 11 11:59:54 2015 +0200
don't initialize the tabs control in calc layer
diff --git a/loleaflet/debug/document/document_simple_example.html b/loleaflet/debug/document/document_simple_example.html
index bf3a26c..35a586f 100644
--- a/loleaflet/debug/document/document_simple_example.html
+++ b/loleaflet/debug/document/document_simple_example.html
@@ -86,5 +86,6 @@
globalMap.addControl(L.control.insertImg());
globalMap.addControl(L.control.dialog());
globalMap.addControl(L.control.partsPreview());
+ globalMap.addControl(L.control.tabs());
</script>
</body></html>
diff --git a/loleaflet/src/layer/tile/CalcTileLayer.js b/loleaflet/src/layer/tile/CalcTileLayer.js
index bf3ba5d..c14bb19 100644
--- a/loleaflet/src/layer/tile/CalcTileLayer.js
+++ b/loleaflet/src/layer/tile/CalcTileLayer.js
@@ -10,7 +10,6 @@ L.CalcTileLayer = L.TileLayer.extend({
this._rows = L.control.rowHeader();
map.addControl(this._columns);
map.addControl(this._rows);
- map.addControl(L.control.tabs());
map.on('scrolloffset', this._onScrollOffset, this);
map.on('updatescrolloffset', this._onUpdateScrollOffset, this);
map.on('zoomend', this._onZoomRowColumns, this);
More information about the Libreoffice-commits
mailing list