[Libreoffice-commits] online.git: 2 commits - loleaflet/src
Szymon Kłos (via logerrit)
logerrit at kemper.freedesktop.org
Tue Oct 29 19:19:42 UTC 2019
loleaflet/src/control/Control.LokDialog.js | 55 ++++++++++++++++++++++-------
1 file changed, 43 insertions(+), 12 deletions(-)
New commits:
commit a7ee73344effaee9e0fc1826633f9987aef67a95
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Thu Jun 13 10:27:29 2019 +0200
Commit: Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Tue Oct 29 20:13:19 2019 +0100
Allow to use scrollbars in dialogs
Change-Id: I95d54100040670aa5f30130eebdf03b8e6cc5dcc
diff --git a/loleaflet/src/control/Control.LokDialog.js b/loleaflet/src/control/Control.LokDialog.js
index 147cac8eb..76ee6738d 100644
--- a/loleaflet/src/control/Control.LokDialog.js
+++ b/loleaflet/src/control/Control.LokDialog.js
@@ -287,6 +287,7 @@ L.Control.LokDialog = L.Control.extend({
return;
if (e.action === 'invalidate') {
+ this.wasInvalidated = true;
var parent = this._getParentId(e.id);
var rectangle = e.rectangle;
if (parent) { // this is a floating window
@@ -665,6 +666,7 @@ L.Control.LokDialog = L.Control.extend({
}
zoomTargets.push({key: targetId, value: zoomTarget, titlebar: titlebar, transformation: transformation, initialState: state, width:width, height: height});
+ var that = this;
var hammerTitlebar = new Hammer(titlebar);
hammerTitlebar.add(new Hammer.Pan({ threshold: 20, pointers: 0 }));
hammerTitlebar.add(new Hammer.Pinch({ threshold: 0 })).recognizeWith([hammerTitlebar.get('pan')]);
@@ -697,8 +699,14 @@ L.Control.LokDialog = L.Control.extend({
hammerContent.on('pinchstart pinchmove', this.onPinch);
hammerContent.on('hammer.input', function(ev) {
if (ev.isFirst) {
+ that.wasInvalidated = false;
draggedObject = ev.target;
}
+ else if (that.wasInvalidated) {
+ draggedObject = null;
+ that.wasInvalidated = false;
+ return;
+ }
if (ev.isFinal && draggedObject) {
var id = toZoomTargetId(draggedObject.id);
commit 3799d72bd81b6d8c68273395d12f350180b0c789
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Tue Jun 11 18:43:54 2019 +0200
Commit: Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Tue Oct 29 20:11:31 2019 +0100
Use separate handlers for titlebar and content
Fix needed for touch devices.
Change-Id: Iffc0e7fe1303b7a0e4aae88ba7649bda0677320f
diff --git a/loleaflet/src/control/Control.LokDialog.js b/loleaflet/src/control/Control.LokDialog.js
index da24702d9..147cac8eb 100644
--- a/loleaflet/src/control/Control.LokDialog.js
+++ b/loleaflet/src/control/Control.LokDialog.js
@@ -60,6 +60,9 @@ L.Control.LokDialog = L.Control.extend({
dialogIdPrefix: 'lokdialog-',
onPan: function (ev) {
+ if (!draggedObject)
+ return;
+
var id = toZoomTargetId(draggedObject.id);
var target = findZoomTarget(id);
@@ -71,8 +74,9 @@ L.Control.LokDialog = L.Control.extend({
if (window.mode.isDesktop() &&
(newX < -target.width/2 || newY < -target.height/2
|| newX > window.innerWidth - target.width/2
- || newY > window.innerHeight - target.height/2))
+ || newY > window.innerHeight - target.height/2)) {
return;
+ }
target.transformation.translate = {
x: newX,
@@ -618,8 +622,6 @@ L.Control.LokDialog = L.Control.extend({
},
_setupGestures: function(dialogContainer, id, canvas) {
- var self = this;
- var dialogID = id;
var targetId = toZoomTargetId(canvas.id);
var zoomTarget = $('#' + targetId).parent().get(0);
var titlebar = $('#' + targetId).prev().children().get(0);
@@ -661,23 +663,44 @@ L.Control.LokDialog = L.Control.extend({
if (findZoomTarget(targetId) != null) {
removeZoomTarget(targetId);
}
-
zoomTargets.push({key: targetId, value: zoomTarget, titlebar: titlebar, transformation: transformation, initialState: state, width:width, height: height});
- var hammerAll = new Hammer(zoomTarget);
- hammerAll.add(new Hammer.Pan({ threshold: 20, pointers: 0 }));
- hammerAll.add(new Hammer.Pinch({ threshold: 0 })).recognizeWith([hammerAll.get('pan')]);
+ var hammerTitlebar = new Hammer(titlebar);
+ hammerTitlebar.add(new Hammer.Pan({ threshold: 20, pointers: 0 }));
+ hammerTitlebar.add(new Hammer.Pinch({ threshold: 0 })).recognizeWith([hammerTitlebar.get('pan')]);
- hammerAll.on('panstart panmove panstop', function(ev) {
- self.onPan(ev, dialogID);
+ hammerTitlebar.on('panstart', this.onPan);
+ hammerTitlebar.on('panmove', this.onPan);
+ hammerTitlebar.on('pinchstart pinchmove', this.onPinch);
+ hammerTitlebar.on('hammer.input', function(ev) {
+ if (ev.isFirst) {
+ draggedObject = ev.target;
+ }
+
+ if (ev.isFinal && draggedObject) {
+ var id = toZoomTargetId(draggedObject.id);
+ var target = findZoomTarget(id);
+ if (target) {
+ target.initialState.startX = target.transformation.translate.x;
+ target.initialState.startY = target.transformation.translate.y;
+ }
+ draggedObject = null;
+ }
});
- hammerAll.on('pinchstart pinchmove', this.onPinch);
- hammerAll.on('hammer.input', function(ev) {
+
+ var hammerContent = new Hammer(canvas);
+ hammerContent.add(new Hammer.Pan({ threshold: 20, pointers: 0 }));
+ hammerContent.add(new Hammer.Pinch({ threshold: 0 })).recognizeWith([hammerContent.get('pan')]);
+
+ hammerContent.on('panstart', this.onPan);
+ hammerContent.on('panmove', this.onPan);
+ hammerContent.on('pinchstart pinchmove', this.onPinch);
+ hammerContent.on('hammer.input', function(ev) {
if (ev.isFirst) {
draggedObject = ev.target;
}
- if (ev.isFinal) {
+ if (ev.isFinal && draggedObject) {
var id = toZoomTargetId(draggedObject.id);
var target = findZoomTarget(id);
if (target) {
More information about the Libreoffice-commits
mailing list