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

2020-01-30 Thread Henry Castro (via logerrit)
 loleaflet/build/deps.js |2 
 loleaflet/src/dom/DomEvent.DoubleTap.js |   77 
 loleaflet/src/dom/DomEvent.LongTap.js   |  148 
 3 files changed, 227 deletions(-)

New commits:
commit d8245a5a99a6aeddae49b756b0bcc75af0674f35
Author: Henry Castro 
AuthorDate: Thu Jan 30 13:30:44 2020 -0400
Commit: Henry Castro 
CommitDate: Thu Jan 30 22:01:28 2020 +0100

loleaflet: mobile: remove unused 'long tap' and 'double tap' files

They are no longer used instead of the Hammer recognizer library

Change-Id: Ied076c5731dcaeca37e1a15b6b637cbb62250b20
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/87751
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Henry Castro 

diff --git a/loleaflet/build/deps.js b/loleaflet/build/deps.js
index f3e8b72e6..29026afca 100644
--- a/loleaflet/build/deps.js
+++ b/loleaflet/build/deps.js
@@ -235,7 +235,6 @@ var deps = {
 
TouchZoom: {
src: ['dom/DomEvent.js',
- 'dom/DomEvent.DoubleTap.js',
  'dom/DomEvent.Pointer.js',
  'core/Handler.js',
  'map/handler/Map.TouchGesture.js'],
@@ -362,7 +361,6 @@ var deps = {
ControlTabs: {
src: ['control/Control.js',
  'dom/DomEvent.js',
- 'dom/DomEvent.LongTap.js',
  'control/Control.Tabs.js'],
heading: 'Controls',
desc: 'Tabs for switching sheets'
diff --git a/loleaflet/src/dom/DomEvent.DoubleTap.js 
b/loleaflet/src/dom/DomEvent.DoubleTap.js
deleted file mode 100644
index 459c54e69..0
--- a/loleaflet/src/dom/DomEvent.DoubleTap.js
+++ /dev/null
@@ -1,77 +0,0 @@
-/* -*- js-indent-level: 8 -*- */
-/*
- * Extends the event handling code with double tap support for mobile browsers.
- */
-
-L.extend(L.DomEvent, {
-
-   _touchstart: L.Browser.msPointer ? 'MSPointerDown' : L.Browser.pointer 
? 'pointerdown' : 'touchstart',
-   _touchend: L.Browser.msPointer ? 'MSPointerUp' : L.Browser.pointer ? 
'pointerup' : 'touchend',
-
-   // inspired by Zepto touch code by Thomas Fuchs
-   addDoubleTapListener: function (obj, handler, id) {
-   var last, touch,
-   doubleTap = false,
-   delay = 250;
-
-   function onTouchStart(e) {
-   var count;
-
-   if (L.Browser.pointer) {
-   count = L.DomEvent._pointersCount;
-   } else {
-   count = e.touches.length;
-   }
-
-   if (count > 1) { return; }
-
-   var now = Date.now(),
-   delta = now - (last || now);
-
-   touch = e.touches ? e.touches[0] : e;
-   doubleTap = (delta > 0 && delta <= delay);
-   last = now;
-   }
-
-   function onTouchEnd() {
-   if (doubleTap) {
-   if (L.Browser.pointer) {
-   // work around .type being readonly 
with MSPointer* events
-   var newTouch = {},
-   prop, i;
-
-   for (i in touch) {
-   prop = touch[i];
-   newTouch[i] = prop && prop.bind 
? prop.bind(touch) : prop;
-   }
-   touch = newTouch;
-   }
-   touch.type = 'dblclick';
-   touch.button = 0;
-   handler(touch);
-   last = null;
-   }
-   }
-
-   var pre = '_leaflet_',
-   touchstart = this._touchstart,
-   touchend = this._touchend;
-
-   obj[pre + touchstart + id] = onTouchStart;
-   obj[pre + touchend + id] = onTouchEnd;
-
-   obj.addEventListener(touchstart, onTouchStart, false);
-   obj.addEventListener(touchend, onTouchEnd, false);
-   return this;
-   },
-
-   removeDoubleTapListener: function (obj, id) {
-   var pre = '_leaflet_',
-   touchend = obj[pre + this._touchend + id];
-
-   obj.removeEventListener(this._touchstart, obj[pre + 
this._touchstart + id], false);
-   obj.removeEventListener(this._touchend, touchend, false);
-
-   return this;
-   }
-});
diff --git a/loleaflet/src/dom/DomEvent.LongTap.js 
b/loleaflet/src/dom/DomEvent.LongTap.js
deleted file mode 100644
index 05319967e..0
--- a/loleaflet/src/dom/DomEvent.LongTap.js

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

2019-10-15 Thread Henry Castro (via logerrit)
 loleaflet/build/deps.js   |6 --
 loleaflet/src/layer/tile/TileLayer.WMS.js |   85 --
 2 files changed, 91 deletions(-)

New commits:
commit 4e848bfa4ec233951e2f3fd737398b776e9a1dcf
Author: Henry Castro 
AuthorDate: Tue Oct 15 16:45:06 2019 -0400
Commit: Henry Castro 
CommitDate: Tue Oct 15 22:47:59 2019 +0200

loleaflet: remove unused TileLayer.WMS.js file

A Web Map Service (WMS) protocol is not used for Document
Tiled rendering. Probably in the near future if it is required,
we can restore back the file, but meanwhile it is a dead code.

Change-Id: I7f622e335eead6f1ef8d8250394b56b43ae3ea1f
Reviewed-on: https://gerrit.libreoffice.org/80862
Reviewed-by: Henry Castro 
Tested-by: Henry Castro 

diff --git a/loleaflet/build/deps.js b/loleaflet/build/deps.js
index 782ddfc84..28eb45cf9 100644
--- a/loleaflet/build/deps.js
+++ b/loleaflet/build/deps.js
@@ -42,12 +42,6 @@ var deps = {
deps: ['GridLayer']
},
 
-   TileLayerWMS: {
-   src: ['layer/tile/TileLayer.WMS.js'],
-   desc: 'WMS tile layer.',
-   deps: ['TileLayer']
-   },
-
WriterTileLayer: {
src: ['layer/tile/WriterTileLayer.js'],
desc: 'Writer tile layer.',
diff --git a/loleaflet/src/layer/tile/TileLayer.WMS.js 
b/loleaflet/src/layer/tile/TileLayer.WMS.js
deleted file mode 100644
index 3e5630731..0
--- a/loleaflet/src/layer/tile/TileLayer.WMS.js
+++ /dev/null
@@ -1,85 +0,0 @@
-/* -*- js-indent-level: 8 -*- */
-/*
- * L.TileLayer.WMS is used for WMS tile layers.
- */
-
-L.TileLayer.WMS = L.TileLayer.extend({
-
-   defaultWmsParams: {
-   service: 'WMS',
-   request: 'GetMap',
-   version: '1.1.1',
-   layers: '',
-   styles: '',
-   format: 'image/jpeg',
-   transparent: false
-   },
-
-   options: {
-   crs: null,
-   uppercase: false
-   },
-
-   initialize: function (url, options) {
-
-   this._url = url;
-
-   var wmsParams = L.extend({}, this.defaultWmsParams);
-
-   // all keys that are not TileLayer options go to WMS params
-   for (var i in options) {
-   if (!(i in this.options)) {
-   wmsParams[i] = options[i];
-   }
-   }
-
-   options = L.setOptions(this, options);
-
-   wmsParams.width = wmsParams.height = options.tileSize * 
(options.detectRetina && L.Browser.retina ? 2 : 1);
-
-   this.wmsParams = wmsParams;
-   },
-
-   onAdd: function (map) {
-
-   this._crs = this.options.crs || map.options.crs;
-   this._wmsVersion = parseFloat(this.wmsParams.version);
-
-   var projectionKey = this._wmsVersion >= 1.3 ? 'crs' : 'srs';
-   this.wmsParams[projectionKey] = this._crs.code;
-
-   L.TileLayer.prototype.onAdd.call(this, map);
-   },
-
-   getTileUrl: function (coords) {
-
-   var tileBounds = this._tileCoordsToBounds(coords),
-   nw = this._crs.project(tileBounds.getNorthWest()),
-   se = this._crs.project(tileBounds.getSouthEast()),
-
-   bbox = (this._wmsVersion >= 1.3 && this._crs === 
L.CRS.EPSG4326 ?
-   [se.y, nw.x, nw.y, se.x] :
-   [nw.x, se.y, se.x, nw.y]).join(','),
-
-   url = L.TileLayer.prototype.getTileUrl.call(this, coords);
-
-   return url +
-   L.Util.getParamString(this.wmsParams, url, 
this.options.uppercase) +
-   (this.options.uppercase ? '=' : '=') + bbox;
-   },
-
-   setParams: function (params, noRedraw) {
-
-   L.extend(this.wmsParams, params);
-
-   if (!noRedraw) {
-   this.redraw();
-   }
-
-   return this;
-   }
-});
-
-L.tileLayer.wms = function (url, options) {
-   return new L.TileLayer.WMS(url, options);
-};
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-10-11 Thread Henry Castro (via logerrit)
 loleaflet/build/deps.js  |6 +++
 loleaflet/src/control/Control.MobileSlide.js |   54 +++
 loleaflet/src/layer/tile/ImpressTileLayer.js |   21 ++
 3 files changed, 80 insertions(+), 1 deletion(-)

New commits:
commit ae89da611d295c30ca00d575d5ffd27b6c44c223
Author: Henry Castro 
AuthorDate: Fri Oct 11 11:11:51 2019 -0400
Commit: Henry Castro 
CommitDate: Fri Oct 11 17:17:30 2019 +0200

iloleaflet: mobile: add a button to insert a slide in the Impress ...

document

A file is created Control.MobileSlide.js for the purpose to create a
button control at the bottom right of the Impress document only if the 
client
browser is identified as Mobile. The button has the function to create a new
Slide.

Change-Id: I494687a91cf4dc06d08e98c6844b06fb69b2448e
Reviewed-on: https://gerrit.libreoffice.org/80665
Reviewed-by: Henry Castro 
Tested-by: Henry Castro 

diff --git a/loleaflet/build/deps.js b/loleaflet/build/deps.js
index 900ee2733..782ddfc84 100644
--- a/loleaflet/build/deps.js
+++ b/loleaflet/build/deps.js
@@ -405,6 +405,12 @@ var deps = {
desc: 'Attribution control.'
},
 
+   ControlMobileSlide: {
+   src: ['control/Control.js',
+ 'control/Control.MobileSlide.js'],
+   desc: 'Mobile control to add new slide.'
+   },
+
ControlScale: {
src: ['control/Control.js',
  'control/Control.Scale.js'],
diff --git a/loleaflet/src/control/Control.MobileSlide.js 
b/loleaflet/src/control/Control.MobileSlide.js
new file mode 100644
index 0..db7fb2e5f
--- /dev/null
+++ b/loleaflet/src/control/Control.MobileSlide.js
@@ -0,0 +1,54 @@
+/*
+ * L.Control.MobileSlide is used to add new slide button on the Impress 
document.
+ */
+
+L.Control.MobileSlide = L.Control.extend({
+   options: {
+   position: 'bottomright'
+   },
+
+   onAdd: function (map) {
+   this._map = map;
+
+   if (!this._container) {
+   this._initLayout();
+   }
+
+   return this._container;
+   },
+
+   onRemove: function () {
+   this._map = undefined;
+   },
+
+   _onAddSlide: function () {
+   this._map.insertPage();
+   },
+
+   _initLayout: function () {
+   this._container = L.DomUtil.create('div', 'leaflet-control-zoom 
leaflet-bar');
+   this._createButton('+', '', 'leaflet-control-zoom-in',  
this._container, this._onAddSlide,  this);
+   return this._container;
+   },
+
+   _createButton: function (html, title, className, container, fnOnClick, 
context) {
+   var button = L.DomUtil.create('a', className, container);
+   button.innerHTML = html;
+   button.href = '#';
+   button.title = title;
+
+   L.DomEvent
+   .on(button, 'click', L.DomEvent.stopPropagation)
+   .on(button, 'mousedown', L.DomEvent.stopPropagation)
+   .on(button, 'click', L.DomEvent.preventDefault)
+   .on(button, 'click', this._map.focus, this._map)
+   .on(button, 'click', fnOnClick, context);
+
+   return button;
+   },
+});
+
+L.control.mobileSlide = function (options) {
+   return new L.Control.MobileSlide(options);
+};
+
diff --git a/loleaflet/src/layer/tile/ImpressTileLayer.js 
b/loleaflet/src/layer/tile/ImpressTileLayer.js
index a2d6b607b..9e77dc1ee 100644
--- a/loleaflet/src/layer/tile/ImpressTileLayer.js
+++ b/loleaflet/src/layer/tile/ImpressTileLayer.js
@@ -7,6 +7,14 @@
 L.ImpressTileLayer = L.TileLayer.extend({
extraSize: L.point(290, 0),
 
+   initialize: function (url, options) {
+   L.TileLayer.prototype.initialize.call(this, url, options);
+
+   if (window.mode.isMobile()) {
+   this._addButton = L.control.mobileSlide();
+   }
+   },
+
newAnnotation: function (comment) {
if (this._draft) {
return;
@@ -25,13 +33,14 @@ L.ImpressTileLayer = L.TileLayer.extend({
beforeAdd: function (map) {
map.on('zoomend', this._onAnnotationZoom, this);
map.on('updateparts', this.onUpdateParts, this);
+   map.on('updatepermission', this.onUpdatePermission, this);
map.on('AnnotationCancel', this.onAnnotationCancel, this);
map.on('AnnotationReply', this.onReplyClick, this);
map.on('AnnotationSave', this.onAnnotationSave, this);
map.on('AnnotationScrollUp', this.onAnnotationScrollUp, this);
map.on('AnnotationScrollDown', this.onAnnotationScrollDown, 
this);
map.on('resize', this.onResize, this);
-   if (L.Browser.mobile) {
+   

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

2019-05-16 Thread Libreoffice Gerrit user
 loleaflet/build/deps.js|5 +
 loleaflet/src/core/Socket.js   |3 
 loleaflet/src/layer/BackgroundColor.js |  101 +
 3 files changed, 108 insertions(+), 1 deletion(-)

New commits:
commit 5f79f5d89484b3498e97ed67072afad0751454d7
Author: Iván Sánchez Ortega 
AuthorDate: Wed May 8 16:48:05 2019 +0200
Commit: Iván Sánchez Ortega 
CommitDate: Thu May 16 12:21:35 2019 +0200

loleaflet: Background color for Calc

This adds a new L.Layer, L.CalcBackground, which reacts to 'statechange' 
websocket
messages, and sets the background style of the Leaflet container to match
the color of the current Calc sheet.

Change-Id: I33d39c86fb52708419756b85660d7be450c91eba
Reviewed-on: https://gerrit.libreoffice.org/71995
Reviewed-by: Iván Sánchez Ortega 
Tested-by: Iván Sánchez Ortega 

diff --git a/loleaflet/build/deps.js b/loleaflet/build/deps.js
index 4e18f1989..6db2915ba 100644
--- a/loleaflet/build/deps.js
+++ b/loleaflet/build/deps.js
@@ -59,7 +59,10 @@ var deps = {
},
 
CalcTileLayer: {
-   src: ['layer/tile/CalcTileLayer.js'],
+   src: [
+   'layer/tile/CalcTileLayer.js',
+   'layer/BackgroundColor.js',
+   ],
desc: 'Calc tile layer.',
deps: ['TileLayer']
},
diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js
index 3a3d8f269..ecc6f6014 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -746,6 +746,9 @@ L.Socket = L.Class.extend({
tileHeightTwips: 
tileHeightTwips,
docType: command.type
});
+   if (!this._map.options.backgroundLayer) 
{
+   
this._map.options.backgroundLayer = new L.CalcBackground().addTo(this._map);
+   }
}
else {
if (command.type === 'presentation' &&
diff --git a/loleaflet/src/layer/BackgroundColor.js 
b/loleaflet/src/layer/BackgroundColor.js
new file mode 100644
index 0..2e0198e28
--- /dev/null
+++ b/loleaflet/src/layer/BackgroundColor.js
@@ -0,0 +1,101 @@
+/*
+ * A Leaflet layer that just sets the background colour of the map.
+ *
+ * This just changes the map container's style, and does not
+ * implement pane positioning - adding two instances of this
+ * layer to a map at a time will conflict.
+ */
+
+L.BackgroundColor = L.Layer.extend({
+   options: {
+   /*
+* The background color that the map shall take when this layer 
is
+* added to it. Must be a string containing a CSS color value, 
as per
+* https://developer.mozilla.org/en-US/docs/Web/CSS/color_value
+*
+* The default is Leaflet's default grey.
+*/
+   color: '#dfdfdf'
+   },
+
+   onAdd: function() {
+   return this.setColor(this.options.color);
+   },
+
+   remove: function() {
+   delete this._map.style.background;
+   },
+
+   /*
+* Expects a CSS color value. Sets the map background to that color, and
+* resets the 'color' option of this layer.
+*/
+   setColor: function(cssColor) {
+   this.options.color = cssColor;
+   if (this._map) {
+   this._map.getContainer().style.background = cssColor;
+   }
+   return this;
+   }
+});
+
+// Libreoffice-specific functionality follows.
+
+/*
+ * A L.BackgroundColor that automatically resets its color
+ * based on 'statechange' messages from lowsd.
+ */
+L.CalcBackground = L.BackgroundColor.extend({
+   onAdd: function(map) {
+   map.on('commandstatechanged', this._onStateChanged, this);
+   return this.setColor(this.options.color);
+   },
+
+   remove: function() {
+   delete this._map.style.background;
+   this._map.off('commandstatechanged', this._onStateChanged, 
this);
+   },
+
+   // State flag for the heuristic algorithm used in _onStateChanged
+   _bgCanBeSet: true,
+
+   _onStateChanged: function(ev) {
+   // There are lots of statechange events - but there is no 
indication of what the
+   // background color of a Calc sheet is. In order to discern the 
background color
+   // there is a heuristic method which uses three statechange 
events: BackgroundColor,
+   // RowColSelCount and StatusPosDoc.
+   // A BackgroundColor statechange will be regarded as a change 
of background
+   // color only if:
+   // - There has 

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

2019-05-10 Thread Libreoffice Gerrit user
 loleaflet/build/deps.js   |2 
 loleaflet/src/control/Control.Tabs.js |   52 ++-
 loleaflet/src/dom/DomEvent.LongTap.js |  148 ++
 3 files changed, 177 insertions(+), 25 deletions(-)

New commits:
commit d6fe8ff0856170d922d29dbb869496dd24aab233
Author: Iván Sánchez Ortega 
AuthorDate: Fri May 10 11:54:52 2019 +0200
Commit: Szymon Kłos 
CommitDate: Fri May 10 12:40:58 2019 +0200

loleaflet: Make Calc sheet context menu work on iOS safari

This is done with a combination of a 'contextment' event shim in
loleaflet/src/dom/DomEvent.LongTap.js, mimicking the technique from
loleaflet/src/map/handler/Map.Tap.js, and triggering the jQuery
contextmenu manually from such a shimmed 'contextmenu'.

Change-Id: I5cba975b7a5559315c91a8bf4c9a5ced00dfc6e1
Reviewed-on: https://gerrit.libreoffice.org/72115
Reviewed-by: Szymon Kłos 
Tested-by: Szymon Kłos 

diff --git a/loleaflet/build/deps.js b/loleaflet/build/deps.js
index 5a1650e22..4e18f1989 100644
--- a/loleaflet/build/deps.js
+++ b/loleaflet/build/deps.js
@@ -356,6 +356,8 @@ var deps = {
 
ControlTabs: {
src: ['control/Control.js',
+ 'dom/DomEvent.js',
+ 'dom/DomEvent.LongTap.js',
  'control/Control.Tabs.js'],
heading: 'Controls',
desc: 'Tabs for switching sheets'
diff --git a/loleaflet/src/control/Control.Tabs.js 
b/loleaflet/src/control/Control.Tabs.js
index e173c2bac..d120bb08a 100644
--- a/loleaflet/src/control/Control.Tabs.js
+++ b/loleaflet/src/control/Control.Tabs.js
@@ -20,7 +20,7 @@ L.Control.Tabs = L.Control.extend({
}
setTimeout(function() {
$('.spreadsheet-tab').contextMenu(e.perm === 'edit');
-   }, 1000);
+   }, 100);
 
if (window.mode.isMobile() == true) {
if (e.perm === 'edit') {
@@ -38,36 +38,28 @@ L.Control.Tabs = L.Control.extend({
this._initialized = true;
this._tabsInitialized = false;
this._spreadsheetTabs = {};
+   this._tabForContextMenu = 0;
var map = this._map;
var docContainer = map.options.documentContainer;
this._tabsCont = L.DomUtil.create('div', 
'spreadsheet-tabs-container', docContainer.parentElement);
-   L.DomEvent.on(this._tabsCont, 'touchstart',
-   function (e) {
-   if (e && e.touches.length > 1) {
-   L.DomEvent.preventDefault(e);
-   }
-   },
-   this);
 
$.contextMenu({
selector: '.spreadsheet-tab',
className: 'loleaflet-font',
-   callback: function(key, options) {
-   var nPos = 
parseInt(options.$trigger.attr('id').split('spreadsheet-tab')[1]);
-
+   callback: (function(key) {
if (key === 'insertsheetbefore') {
-   map.insertPage(nPos);
+   map.insertPage(this._tabForContextMenu);
}
if (key === 'insertsheetafter') {
-   map.insertPage(nPos + 1);
+   map.insertPage(this._tabForContextMenu 
+ 1);
}
-   },
+   }).bind(this),
items: {
'insertsheetbefore': {name: _('Insert sheet 
before this')},
'insertsheetafter': {name: _('Insert sheet 
after this')},
'deletesheet': {name: _UNO('.uno:Remove', 
'spreadsheet', true),
-   callback: function(key, 
options) {
-   var nPos = 
parseInt(options.$trigger.attr('id').split('spreadsheet-tab')[1]);
+   callback: (function(key, 
options) {
+   var nPos = 
this._tabForContextMenu;
vex.dialog.confirm({
message: _('Are 
you sure you want to delete sheet, %sheet% ?').replace('%sheet%', 
options.$trigger.text()),
callback: 
function(data) {
@@ -76,11 +68,11 @@ L.Control.Tabs = L.Control.extend({
}
}
   

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

2019-04-29 Thread Libreoffice Gerrit user
 loleaflet/build/deps.js  |6 
 loleaflet/src/layer/GeoJSON.js   |  269 ---
 loleaflet/src/layer/vector/Path.Transform.js |9 
 3 files changed, 1 insertion(+), 283 deletions(-)

New commits:
commit bf3c4c56958175d5c3204bbf8578ff1a08c3763a
Author: Henry Castro 
AuthorDate: Mon Apr 29 17:01:51 2019 -0400
Commit: Henry Castro 
CommitDate: Mon Apr 29 22:23:18 2019 -0400

loleaflet: remove GeoJSON.js file

GeoJSON data is no longer used for document tiled rendering

Change-Id: Ic95371947b7e1705ac2431ca06b9a5814d249207

diff --git a/loleaflet/build/deps.js b/loleaflet/build/deps.js
index eea5545a2..5a1650e22 100644
--- a/loleaflet/build/deps.js
+++ b/loleaflet/build/deps.js
@@ -204,12 +204,6 @@ var deps = {
desc: 'Canvas backend for vector layers.'
},
 
-   GeoJSON: {
-   src: ['layer/GeoJSON.js'],
-   deps: ['Polygon', 'Circle', 'CircleMarker', 'Marker', 
'FeatureGroup'],
-   desc: 'GeoJSON layer, parses the data and adds corresponding 
layers above.'
-   },
-
MapDrag: {
src: ['dom/DomEvent.js',
  'dom/Draggable.js',
diff --git a/loleaflet/src/layer/GeoJSON.js b/loleaflet/src/layer/GeoJSON.js
deleted file mode 100644
index 7458da924..0
--- a/loleaflet/src/layer/GeoJSON.js
+++ /dev/null
@@ -1,269 +0,0 @@
-/* -*- js-indent-level: 8 -*- */
-/*
- * L.GeoJSON turns any GeoJSON data into a Leaflet layer.
- */
-
-L.GeoJSON = L.FeatureGroup.extend({
-
-   initialize: function (geojson, options) {
-   L.setOptions(this, options);
-
-   this._layers = {};
-
-   if (geojson) {
-   this.addData(geojson);
-   }
-   },
-
-   addData: function (geojson) {
-   var features = L.Util.isArray(geojson) ? geojson : 
geojson.features,
-   i, len, feature;
-
-   if (features) {
-   for (i = 0, len = features.length; i < len; i++) {
-   // only add this if geometry or geometries are 
set and not null
-   feature = features[i];
-   if (feature.geometries || feature.geometry || 
feature.features || feature.coordinates) {
-   this.addData(feature);
-   }
-   }
-   return this;
-   }
-
-   var options = this.options;
-
-   if (options.filter && !options.filter(geojson)) { return this; }
-
-   var layer = L.GeoJSON.geometryToLayer(geojson, options);
-   layer.feature = L.GeoJSON.asFeature(geojson);
-
-   layer.defaultOptions = layer.options;
-   this.resetStyle(layer);
-
-   if (options.onEachFeature) {
-   options.onEachFeature(geojson, layer);
-   }
-
-   return this.addLayer(layer);
-   },
-
-   resetStyle: function (layer) {
-   // reset any custom styles
-   layer.options = layer.defaultOptions;
-   this._setLayerStyle(layer, this.options.style);
-   return this;
-   },
-
-   setStyle: function (style) {
-   return this.eachLayer(function (layer) {
-   this._setLayerStyle(layer, style);
-   }, this);
-   },
-
-   _setLayerStyle: function (layer, style) {
-   if (typeof style === 'function') {
-   style = style(layer.feature);
-   }
-   if (layer.setStyle) {
-   layer.setStyle(style);
-   }
-   }
-});
-
-L.extend(L.GeoJSON, {
-   geometryToLayer: function (geojson, options) {
-
-   var geometry = geojson.type === 'Feature' ? geojson.geometry : 
geojson,
-   coords = geometry.coordinates,
-   layers = [],
-   pointToLayer = options && options.pointToLayer,
-   coordsToLatLng = options && options.coordsToLatLng || 
this.coordsToLatLng,
-   latlng, latlngs, i, len;
-
-   switch (geometry.type) {
-   case 'Point':
-   latlng = coordsToLatLng(coords);
-   return pointToLayer ? pointToLayer(geojson, latlng) : 
new L.Marker(latlng);
-
-   case 'MultiPoint':
-   for (i = 0, len = coords.length; i < len; i++) {
-   latlng = coordsToLatLng(coords[i]);
-   layers.push(pointToLayer ? 
pointToLayer(geojson, latlng) : new L.Marker(latlng));
-   }
-   return new L.FeatureGroup(layers);
-
-   case 'LineString':
-   case 'MultiLineString':
-   latlngs = 

[Libreoffice-commits] online.git: loleaflet/build loleaflet/src scripts/unocommands.py

2019-03-30 Thread Libreoffice Gerrit user
 loleaflet/build/deps.js |2 +-
 scripts/unocommands.py  |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 59306e2f4c9b6d9ea2d669b5b9ae45573bbbc160
Author: Henry Castro 
AuthorDate: Sat Mar 30 16:09:59 2019 -0400
Commit: Henry Castro 
CommitDate: Sat Mar 30 16:22:32 2019 -0400

loleaflet: rename toolbar.js to Control.Toolbar.js

Change-Id: Ia8d0c3856ea40b4e342e5bec94c558c78464943f

diff --git a/loleaflet/build/deps.js b/loleaflet/build/deps.js
index 88f60116f..eea5545a2 100644
--- a/loleaflet/build/deps.js
+++ b/loleaflet/build/deps.js
@@ -292,7 +292,7 @@ var deps = {
},
 
ControlToolbar: {
-   src: ['control/toolbar.js'],
+   src: ['control/Control.Toolbar.js'],
heading: 'Controls',
desc: 'LibreOffice Online toolbar'
},
diff --git a/loleaflet/src/control/toolbar.js 
b/loleaflet/src/control/Control.Toolbar.js
similarity index 100%
rename from loleaflet/src/control/toolbar.js
rename to loleaflet/src/control/Control.Toolbar.js
diff --git a/scripts/unocommands.py b/scripts/unocommands.py
index df29ef8e5..3e5ec6bb8 100755
--- a/scripts/unocommands.py
+++ b/scripts/unocommands.py
@@ -122,7 +122,7 @@ def extractToolbarCommands(path):
 commands = []
 
 # extract from the menu specifications
-f = open(path + '/loleaflet/src/control/toolbar.js', 'r')
+f = open(path + '/loleaflet/src/control/Control.Toolbar.js', 'r')
 for line in f:
 if line.find("_UNO(") >= 0:
 commands += commandFromMenuLine(line)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-03-05 Thread Libreoffice Gerrit user
 loleaflet/build/deps.js  |   24 
 loleaflet/src/geo/crs/CRS.EPSG3395.js|   14 
 loleaflet/src/geo/crs/CRS.EPSG3857.js|   18 
 loleaflet/src/geo/crs/CRS.EPSG4326.js|   10 
 loleaflet/src/geo/crs/CRS.Earth.js   |   21 
 loleaflet/src/geo/projection/Projection.Mercator.js  |   44 -
 loleaflet/src/geo/projection/Projection.SphericalMercator.js |   32 -
 loleaflet/src/layer/GeoJSON.js   |  269 ---
 loleaflet/src/map/ext/Map.Geolocation.js |   92 ---
 9 files changed, 524 deletions(-)

New commits:
commit 83130d1e45b7b5706835c7cb7ee057f0fc34fb9c
Author: Henry Castro 
AuthorDate: Tue Feb 12 14:57:19 2019 -0400
Commit: Henry Castro 
CommitDate: Tue Mar 5 23:46:29 2019 -0400

loleaflet: remove unused map geolocation code

Change-Id: I14f4ca2bade957f0105f31838efe26601d965943

diff --git a/loleaflet/build/deps.js b/loleaflet/build/deps.js
index a050edf47..933c39c6d 100644
--- a/loleaflet/build/deps.js
+++ b/loleaflet/build/deps.js
@@ -19,25 +19,14 @@ var deps = {
  'geo/LatLng.js',
  'geo/LatLngBounds.js',
  'geo/projection/Projection.LonLat.js',
- 'geo/projection/Projection.SphericalMercator.js',
  'geo/crs/CRS.js',
  'geo/crs/CRS.Simple.js',
- 'geo/crs/CRS.Earth.js',
- 'geo/crs/CRS.EPSG3857.js',
- 'geo/crs/CRS.EPSG4326.js',
  'map/Map.js',
  'layer/Layer.js'
  ],
desc: 'The core of the library, including OOP, events, DOM 
facilities, basic units, projections (EPSG:3857 and EPSG:4326) and the base Map 
class.'
},
 
-   EPSG3395: {
-   src: ['geo/projection/Projection.Mercator.js',
- 'geo/crs/CRS.EPSG3395.js'],
-   desc: 'EPSG:3395 projection (used by some map providers).',
-   heading: 'Additional projections'
-   },
-
GridLayer: {
src: ['layer/tile/GridLayer.js'],
desc: 'Used as base class for grid-like layers like TileLayer.',
@@ -191,13 +180,6 @@ var deps = {
desc: 'Canvas backend for vector layers.'
},
 
-   GeoJSON: {
-   src: ['layer/GeoJSON.js'],
-   deps: ['Polygon', 'Circle', 'CircleMarker', 'Marker', 
'FeatureGroup'],
-   desc: 'GeoJSON layer, parses the data and adds corresponding 
layers above.'
-   },
-
-
MapDrag: {
src: ['dom/DomEvent.js',
  'dom/Draggable.js',
@@ -462,12 +444,6 @@ var deps = {
desc: 'Smooth zooming animation. Works only on browsers that 
support CSS3 Transitions.'
},
 
-   Geolocation: {
-   src: ['map/ext/Map.Geolocation.js'],
-   desc: 'Adds Map#locate method and related events to make 
geolocation easier.',
-   heading: 'Misc'
-   },
-
AnnotationManager: {
src: ['layer/AnnotationManager.js'],
desc: 'Group Annotations to put on the map.'
diff --git a/loleaflet/src/geo/crs/CRS.EPSG3395.js 
b/loleaflet/src/geo/crs/CRS.EPSG3395.js
deleted file mode 100644
index be1429c7f..0
--- a/loleaflet/src/geo/crs/CRS.EPSG3395.js
+++ /dev/null
@@ -1,14 +0,0 @@
-/* -*- js-indent-level: 8 -*- */
-/*
- * L.CRS.EPSG3857 (World Mercator) CRS implementation.
- */
-
-L.CRS.EPSG3395 = L.extend({}, L.CRS.Earth, {
-   code: 'EPSG:3395',
-   projection: L.Projection.Mercator,
-
-   transformation: (function () {
-   var scale = 0.5 / (Math.PI * L.Projection.Mercator.R);
-   return new L.Transformation(scale, 0.5, -scale, 0.5);
-   }())
-});
diff --git a/loleaflet/src/geo/crs/CRS.EPSG3857.js 
b/loleaflet/src/geo/crs/CRS.EPSG3857.js
deleted file mode 100644
index 3373d6630..0
--- a/loleaflet/src/geo/crs/CRS.EPSG3857.js
+++ /dev/null
@@ -1,18 +0,0 @@
-/* -*- js-indent-level: 8 -*- */
-/*
- * L.CRS.EPSG3857 (Spherical Mercator) is the most common CRS for web mapping 
and is used by Leaflet by default.
- */
-
-L.CRS.EPSG3857 = L.extend({}, L.CRS.Earth, {
-   code: 'EPSG:3857',
-   projection: L.Projection.SphericalMercator,
-
-   transformation: (function () {
-   var scale = 0.5 / (Math.PI * L.Projection.SphericalMercator.R);
-   return new L.Transformation(scale, 0.5, -scale, 0.5);
-   }())
-});
-
-L.CRS.EPSG900913 = L.extend({}, L.CRS.EPSG3857, {
-   code: 'EPSG:900913'
-});
diff --git a/loleaflet/src/geo/crs/CRS.EPSG4326.js 
b/loleaflet/src/geo/crs/CRS.EPSG4326.js
deleted file mode 100644
index 0f90029ac..0
--- a/loleaflet/src/geo/crs/CRS.EPSG4326.js
+++ /dev/null
@@ -1,10 +0,0 @@
-/* -*- js-indent-level: 8 -*- */

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

2018-02-19 Thread Henry Castro
 loleaflet/build/deps.js   |7 -
 loleaflet/src/control/Control.ColumnHeader.js |9 --
 loleaflet/src/control/Control.MetricInput.js  |  102 --
 loleaflet/src/control/Control.RowHeader.js|7 -
 4 files changed, 2 insertions(+), 123 deletions(-)

New commits:
commit 64e6cf189c028e7b2be8ead0d58e1a2b43f66d16
Author: Henry Castro 
Date:   Mon Feb 19 15:14:11 2018 -0400

loleaflet: remove MetricInput dialog

Change-Id: I64dbd732caac575cc15e0b0b1fb5762c2678fe76

diff --git a/loleaflet/build/deps.js b/loleaflet/build/deps.js
index 9fd024f9..9c905d76 100644
--- a/loleaflet/build/deps.js
+++ b/loleaflet/build/deps.js
@@ -292,13 +292,6 @@ var deps = {
desc: 'Row Header bar'
},
 
-   ControlMetricInput: {
-   src: ['control/Control.js',
- 'control/Control.MetricInput.js'],
-   heading: 'Controls',
-   desc: 'Metric Input'
-   },
-
ControlDocumentRepair: {
src: ['control/Control.js',
  'control/Control.DocumentRepair.js'],
diff --git a/loleaflet/src/control/Control.ColumnHeader.js 
b/loleaflet/src/control/Control.ColumnHeader.js
index 7871436b..b377582b 100644
--- a/loleaflet/src/control/Control.ColumnHeader.js
+++ b/loleaflet/src/control/Control.ColumnHeader.js
@@ -109,17 +109,10 @@ L.Control.ColumnHeader = L.Control.Header.extend({
},
 
optimalWidth: function(index) {
-   if (!this._dialog) {
-   this._dialog = 
L.control.metricInput(this._onDialogResult, this,
-
this._map._docLayer.twipsToHMM(this._map._docLayer.STD_EXTRA_WIDTH),
-{title: 
_UNO('.uno:SetOptimalColumnWidth', 'spreadsheet', true).replace('...', '')});
-   }
if (this._map._docLayer._selections.getLayers().length === 0) {
this._selectColumn(index, 0);
}
-   this._dialog.addTo(this._map);
-   this._map.enable(false);
-   this._dialog.show();
+   this._map.sendUnoCommand('.uno:SetOptimalColumnWidth');
},
 
insertColumn: function(index) {
diff --git a/loleaflet/src/control/Control.MetricInput.js 
b/loleaflet/src/control/Control.MetricInput.js
deleted file mode 100644
index c174bcef..
--- a/loleaflet/src/control/Control.MetricInput.js
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * L.Control.MetricInput.
- */
-/* global _ */
-L.Control.MetricInput = L.Control.extend({
-   options: {
-   position: 'topmiddle',
-   title: ''
-   },
-
-   initialize: function (callback, context, value, options) {
-   L.setOptions(this, options);
-
-   this._callback = callback;
-   this._context = context;
-   this._default = value;
-   },
-
-   onAdd: function () {
-   this._initLayout();
-
-   return this._container;
-   },
-
-   _initLayout: function () {
-   var className = 'leaflet-control-layers',
-   container = this._container = L.DomUtil.create('div', 
className);
-   container.style.visibility = 'hidden';
-
-   var closeButton = L.DomUtil.create('a', 
'leaflet-popup-close-button', container);
-   closeButton.href = '#close';
-   closeButton.innerHTML = '';
-   L.DomEvent.on(closeButton, 'click', this._onCloseButtonClick, 
this);
-
-   var wrapper = L.DomUtil.create('div', 
'leaflet-popup-content-wrapper', container);
-   var content = L.DomUtil.create('div', 'leaflet-popup-content', 
wrapper);
-   var labelTitle = document.createElement('span');
-   labelTitle.innerHTML = '' + this.options.title + ' ' + 
_('(100th/mm)') + '';
-   content.appendChild(labelTitle);
-   content.appendChild(document.createElement('br'));
-   content.appendChild(document.createElement('br'));
-
-   var labelAdd = document.createElement('span');
-   labelAdd.innerHTML = _('Add: ');
-   content.appendChild(labelAdd);
-
-   var inputMetric = this._input = document.createElement('input');
-   inputMetric.type = 'text';
-   inputMetric.value = this._default;
-   content.appendChild(inputMetric);
-   content.appendChild(document.createElement('br'));
-   content.appendChild(document.createElement('br'));
-
-   var inputValue = document.createElement('input');
-   inputValue.type = 'checkbox';
-   inputValue.checked = true;
-   L.DomEvent.on(inputValue, 'click', this._onDefaultClick, this);
-   content.appendChild(inputValue);
-

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

2016-09-14 Thread Henry Castro
 loleaflet/build/deps.js  |3 -
 loleaflet/src/layer/vector/Path.Popup.js |   72 +++
 loleaflet/src/layer/vector/SVG.js|   21 +
 3 files changed, 95 insertions(+), 1 deletion(-)

New commits:
commit 44c3d5dfdec440164abbae9833fe9a7b6a96aa0f
Author: Henry Castro 
Date:   Wed Sep 14 19:22:31 2016 -0400

loleaflet: add Path.Popup

diff --git a/loleaflet/build/deps.js b/loleaflet/build/deps.js
index cb83325..58a2ff1 100644
--- a/loleaflet/build/deps.js
+++ b/loleaflet/build/deps.js
@@ -119,7 +119,8 @@ var deps = {
Path: {
src: [
'layer/vector/Renderer.js',
-   'layer/vector/Path.js'
+   'layer/vector/Path.js',
+   'layer/vector/Path.Popup.js'
],
desc: 'Vector rendering core.',
heading: 'Vector layers'
diff --git a/loleaflet/src/layer/vector/Path.Popup.js 
b/loleaflet/src/layer/vector/Path.Popup.js
new file mode 100644
index 000..a3dcef5
--- /dev/null
+++ b/loleaflet/src/layer/vector/Path.Popup.js
@@ -0,0 +1,72 @@
+/*
+ * Popup extension to L.Path (polylines, polygons, circles), adding 
popup-related methods.
+ */
+
+L.Path.include({
+
+   bindPopup: function (content, options) {
+
+   if (content instanceof L.Popup) {
+   this._popup = content;
+   } else {
+   if (!this._popup || options) {
+   this._popup = new L.Popup(options, this);
+   }
+   this._popup.setContent(content);
+   }
+
+   if (!this._popupHandlersAdded) {
+   this.on({
+   mouseover: this._openPopup,
+   mouseout: this._delayClose,
+   remove: this.closePopup,
+   add: this.firstPopup
+   });
+
+   this._popupHandlersAdded = true;
+   }
+
+   return this;
+   },
+
+   unbindPopup: function () {
+   if (this._popup) {
+   this._popup = null;
+   this.off({
+   mouseover: this._openPopup,
+   mouseout: this._delayClose,
+   remove: this.closePopup,
+   add: this.firstPopup
+   });
+
+   this._popupHandlersAdded = false;
+   }
+   return this;
+   },
+
+   firstPopup: function (e) {
+   if (this._popup) {
+   this._openPopup({latlng: this._bounds.getCenter()});
+   }
+   },
+
+   closePopup: function () {
+   if (this._popup) {
+   this._popup._close();
+   }
+   return this;
+   },
+
+   _delayClose: function () {
+   clearTimeout(this._timer);
+   this._timer = setTimeout(L.bind(this.closePopup, this), 3000);
+   },
+
+   _openPopup: function (e) {
+   if (!this._map.hasLayer(this._popup)) {
+   this._popup.setLatLng(e.latlng);
+   this._map.openPopup(this._popup);
+   this._delayClose();
+   }
+   }
+});
diff --git a/loleaflet/src/layer/vector/SVG.js 
b/loleaflet/src/layer/vector/SVG.js
index 3b203df..9d0affb 100644
--- a/loleaflet/src/layer/vector/SVG.js
+++ b/loleaflet/src/layer/vector/SVG.js
@@ -45,11 +45,32 @@ L.SVG = L.Renderer.extend({
 
if (layer.options.interactive) {
L.DomUtil.addClass(path, 'leaflet-interactive');
+
+   var events = ['mouseenter', 'mouseout'];
+   for (var i = 0; i < events.length; i++) {
+   L.DomEvent.on(path, events[i], 
this._fireMouseEvent, this);
+   }
}
 
this._updateStyle(layer);
},
 
+   _fireMouseEvent: function (e) {
+   if (!this._map || !this.hasEventListeners(e.type)) { return; }
+
+   var map = this._map,
+   containerPoint = map.mouseEventToContainerPoint(e),
+   layerPoint = map.containerPointToLayerPoint(containerPoint),
+   latlng = map.layerPointToLatLng(layerPoint);
+
+   this.fire(e.type, {
+   latlng: latlng,
+   layerPoint: layerPoint,
+   containerPoint: containerPoint,
+   originalEvent: e
+   });
+   },
+
_addPath: function (layer) {
this._container.appendChild(layer._path);
layer.addInteractiveTarget(layer._path);

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

2016-08-07 Thread Henry Castro
 loleaflet/build/deps.js   |   15 +++--
 loleaflet/src/control/Control.ColumnHeader.js |   38 -
 loleaflet/src/control/Control.Header.js   |   75 ++
 loleaflet/src/control/Control.RowHeader.js|   38 -
 4 files changed, 160 insertions(+), 6 deletions(-)

New commits:
commit 77224486f28c12b34d004790fa2fcd4595f31b65
Author: Henry Castro 
Date:   Sun Aug 7 11:13:59 2016 -0400

loleaflet: add drag & drop Column/Row resize

diff --git a/loleaflet/build/deps.js b/loleaflet/build/deps.js
index 105cc6b..284aca3 100644
--- a/loleaflet/build/deps.js
+++ b/loleaflet/build/deps.js
@@ -260,30 +260,37 @@ var deps = {
desc: 'Parts preview sidebar'
},
 
+   ControlHeader: {
+   src: ['control/Control.js',
+ 'control/Control.Header.js'],
+   heading: 'Controls',
+   desc: 'Header Item'
+   },
+
ControlColumnHeader: {
src: ['control/Control.js',
- 'control/Control.ColumnHeader.js'],
+ 'control/Control.ColumnHeader.js'],
heading: 'Controls',
desc: 'Column Header bar'
},
 
ControlRowHeader: {
src: ['control/Control.js',
- 'control/Control.RowHeader.js'],
+ 'control/Control.RowHeader.js'],
heading: 'Controls',
desc: 'Row Header bar'
},
 
ControlContextmenu: {
src: ['control/Control.js',
-   'control/Control.ContextMenu.js'],
+ 'control/Control.ContextMenu.js'],
heading: 'Controls',
desc: 'Context Menu'
},
 
ControlMenubar: {
src: ['control/Control.js',
-   'control/Control.Menubar.js'],
+ 'control/Control.Menubar.js'],
heading: 'Controls',
desc: 'Menu bar'
},
diff --git a/loleaflet/src/control/Control.ColumnHeader.js 
b/loleaflet/src/control/Control.ColumnHeader.js
index 45d48b5..cd0460f 100644
--- a/loleaflet/src/control/Control.ColumnHeader.js
+++ b/loleaflet/src/control/Control.ColumnHeader.js
@@ -3,7 +3,11 @@
 */
 
 /* global $ _ */
-L.Control.ColumnHeader = L.Control.extend({
+L.Control.ColumnHeader = L.Control.Header.extend({
+   options: {
+   cursor: 'col-resize'
+   },
+
onAdd: function (map) {
map.on('updatepermission', this._onUpdatePermission, this);
this._initialized = false;
@@ -101,6 +105,8 @@ L.Control.ColumnHeader = L.Control.extend({
column = L.DomUtil.create('div', 
'spreadsheet-header-column', this._columns);
text = L.DomUtil.create('div', 
'spreadsheet-header-column-text', column);
resize = L.DomUtil.create('div', 
'spreadsheet-header-column-resize', column);
+   resize.column = iterator + 1;
+   resize.width = width;
var content = columns[iterator].text;
text.setAttribute('rel', 'spreadsheet-column-' + 
content); // for easy addressing
text.innerHTML = content;
@@ -114,6 +120,7 @@ L.Control.ColumnHeader = L.Control.extend({
L.DomUtil.setStyle(resize, 'width', '3px');
}
L.DomEvent.addListener(text, 'click', 
this._onColumnHeaderClick, this);
+   this.mouseInit(resize);
}
},
 
@@ -163,6 +170,35 @@ L.Control.ColumnHeader = L.Control.extend({
this._map.sendUnoCommand('.uno:SelectAll');
},
 
+   onDragStart: function (item, start, end) {
+   // add vertical line
+   },
+
+   onDragMove: function (item, start, end) {
+   // move vertical line
+   },
+
+   onDragEnd: function (item, start, end) {
+   var distance = 
this._map._docLayer._pixelsToTwips(end.subtract(start));
+
+   if (distance.x > 0 && item.width != distance.x) {
+   var command = {
+   Column: {
+   type: 'unsigned short',
+   value: item.column
+   },
+   Width: {
+   type: 'unsigned short',
+   value: distance.x
+   }
+   };
+
+   this._map.sendUnoCommand('.uno:ColumnWidth', command);
+   }
+
+   // remove vertical line
+   },
+
_onUpdatePermission: function (e) {
if (this._map.getDocType() !== 'spreadsheet') {

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

2015-07-16 Thread Mihai Varga
 loleaflet/build/deps.js|7 +
 loleaflet/src/layer/tile/TileLayer.js  |  109 ---
 loleaflet/src/map/handler/Map.Mouse.js |  131 +
 3 files changed, 137 insertions(+), 110 deletions(-)

New commits:
commit e8eedf3f258300bc54c0074cd56a26ee821d4ad9
Author: Mihai Varga mihai.va...@collabora.com
Date:   Thu Jul 16 16:15:30 2015 +0300

loleaflet: moved mouse handler from TileLayer.js - Map.Mouse.js

diff --git a/loleaflet/build/deps.js b/loleaflet/build/deps.js
index c5927ba..a3d0ee9 100644
--- a/loleaflet/build/deps.js
+++ b/loleaflet/build/deps.js
@@ -192,7 +192,12 @@ var deps = {
 
Keyboard: {
src: ['map/handler/Map.Keyboard.js'],
-   desc: 'Enables keyboard pan/zoom when the map is focused.'
+   desc: 'Handles keyboard interaction with the document.'
+   },
+
+   Mouse: {
+   src: ['map/handler/Map.Mouse.js'],
+   desc: 'Handles mouse interaction with the document.'
},
 
MarkerDrag: {
diff --git a/loleaflet/src/layer/tile/TileLayer.js 
b/loleaflet/src/layer/tile/TileLayer.js
index e7af468..ac74511 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -89,7 +89,6 @@ L.TileLayer = L.GridLayer.extend({
}),
draggable: true
});
-   this._mouseEventsQueue = [];
this._pendingTilesCount = 0;
this._textArea = L.DomUtil.get('clipboard');
this._textArea.focus();
@@ -110,8 +109,6 @@ L.TileLayer = L.GridLayer.extend({
this._map.on('clearselection', this._clearSelections, this);
this._map.on('drag', this._updateScrollOffset, this);
this._map.on('copy', this._onCopy, this);
-   this._map.on('mousedown mouseup mouseover mouseout mousemove 
dblclick',
-   this._onMouseEvent, this);
this._startMarker.on('drag dragend', 
this._onSelectionHandleDrag, this);
this._endMarker.on('drag dragend', this._onSelectionHandleDrag, 
this);
if (this.options.edit  !this.options.readOnly) {
@@ -679,113 +676,7 @@ L.TileLayer = L.GridLayer.extend({
' x=' + x + ' y=' + y);
},
 
-   _onMouseEvent: function (e) {
-   if (this._graphicMarker  this._graphicMarker.isDragged) {
-   return;
-   }
-
-   if (this._startMarker.isDragged === true || 
this._endMarker.isDragged === true) {
-   return;
-   }
-
-   if (e.type === 'mousedown') {
-   this._mouseDown = true;
-   if (this._holdMouseEvent) {
-   clearTimeout(this._holdMouseEvent);
-   }
-   var mousePos = this._latLngToTwips(e.latlng);
-   this._mouseEventsQueue.push(L.bind(function() {
-   this._postMouseEvent('buttondown', mousePos.x, 
mousePos.y, 1);}, this));
-   this._holdMouseEvent = 
setTimeout(L.bind(this._executeMouseEvents, this), 500);
-   }
-   else if (e.type === 'mouseup') {
-   this._mouseDown = false;
-   if (this._map.dragging.enabled()) {
-   if (this._mouseEventsQueue.length === 0) {
-   // mouse up after panning
-   return;
-   }
-   }
-   clearTimeout(this._holdMouseEvent);
-   this._holdMouseEvent = null;
-   if (this._clickTime  Date.now() - this._clickTime = 
250) {
-   // double click, a click was sent already
-   this._mouseEventsQueue = [];
-   return;
-   }
-   else {
-   this._clickTime = Date.now();
-   mousePos = this._latLngToTwips(e.latlng);
-   var timeOut = 250;
-   if (this._permission === 'edit') {
-   timeOut = 0;
-   }
-   this._mouseEventsQueue.push(L.bind(function() {
-   // if it's a click or mouseup after 
selecting
-   if (this._mouseEventsQueue.length  1) {
-   // it's a click, fire mousedown
-   this._mouseEventsQueue[0]();
-   if (this._permission === 
'view') {
- 

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

2015-05-28 Thread Mihai Varga
 loleaflet/build/deps.js  |7 +++
 loleaflet/src/control/Control.StatusIndicator.js |   46 +++
 loleaflet/src/layer/tile/TileLayer.js|   10 +
 3 files changed, 63 insertions(+)

New commits:
commit 2fa440c18f75e81748f9780762979854b8d7e9f9
Author: Mihai Varga mihai.va...@collabora.com
Date:   Thu May 28 18:43:29 2015 +0300

Status indicator control

diff --git a/loleaflet/build/deps.js b/loleaflet/build/deps.js
index b3e838d..e1fd636 100644
--- a/loleaflet/build/deps.js
+++ b/loleaflet/build/deps.js
@@ -227,6 +227,13 @@ var deps = {
desc: 'Switches from viewing to editing mode and backwards'
},
 
+   ControlStatusIndicator: {
+   src: ['control/Control.js',
+ 'control/Control.StatusIndicator.js'],
+   heading: 'Controls',
+   desc: 'Display document loading status'
+   },
+
ControlAttrib: {
src: ['control/Control.js',
  'control/Control.Attribution.js'],
diff --git a/loleaflet/src/control/Control.StatusIndicator.js 
b/loleaflet/src/control/Control.StatusIndicator.js
new file mode 100644
index 000..96b9da9
--- /dev/null
+++ b/loleaflet/src/control/Control.StatusIndicator.js
@@ -0,0 +1,46 @@
+/*
+ * L.Control.StatusIndicator is used for displaying the current loading status
+ */
+
+L.Control.StatusIndicator = L.Control.extend({
+   options: {
+   position: 'topleft',
+   },
+
+   onAdd: function (map) {
+   var partName = 'leaflet-control-statusindicator';
+   this._container = L.DomUtil.create('div', partName + ' 
leaflet-bar');
+
+   map.on('statusindicator:start statusindicator:setvalue 
statusindicator:finish',
+   this._updateStatus, this);
+   return this._container;
+   },
+
+   _updateStatus: function (e) {
+   if (e.type === 'statusindicator:start') {
+   L.DomUtil.setStyle(this._container, 'display', '');
+   this._container.innerText = '0 %';
+   }
+   else if (e.type === 'statusindicator:setvalue') {
+   this._container.innerText = e.statusIndicator + '% ';
+   }
+   else if (e.type === 'statusindicator:finish') {
+   L.DomUtil.setStyle(this._container, 'display', 'none');
+   }
+   }
+});
+
+L.Map.mergeOptions({
+   statusIndicatorControl: true
+});
+
+L.Map.addInitHook(function () {
+   if (this.options.statusIndicatorControl) {
+   this.statusIndicatorControl = new L.Control.StatusIndicator();
+   this.addControl(this.statusIndicatorControl);
+   }
+});
+
+L.control.statusIndicator = function (options) {
+   return new L.Control.StatusIndicator(options);
+};
diff --git a/loleaflet/src/layer/tile/TileLayer.js 
b/loleaflet/src/layer/tile/TileLayer.js
index 6bcab24..a4ee0b4 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -194,6 +194,16 @@ L.TileLayer = L.GridLayer.extend({
this._update();
}
}
+   else if (textMsg.startsWith('statusindicatorstart:')) {
+   this._map.fire('statusindicator:start');
+   }
+   else if (textMsg.startsWith('statusindicatorsetvalue:')) {
+   var statusIndicator = textMsg.match(/\d+/g)[0];
+   this._map.fire('statusindicator:setvalue', 
{statusIndicator:statusIndicator});
+   }
+   else if (textMsg.startsWith('statusindicatorfinish:')) {
+   this._map.fire('statusindicator:finish');
+   }
else if (textMsg.startsWith('tile:')) {
var command = this._parseServerCmd(textMsg);
var coords = this._twipsToCoords(new L.Point(command.x, 
command.y));
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits