[Libreoffice-commits] online.git: 2 commits - loleaflet/dist

Pranav Kant pranavk at collabora.com
Wed Apr 27 10:45:09 UTC 2016


 loleaflet/dist/toolbar/toolbar.js |   37 ++++++++++++++++++++++++++-----------
 1 file changed, 26 insertions(+), 11 deletions(-)

New commits:
commit cc0814df04db4f8db31e6a4e85d157e319cbc611
Author: Pranav Kant <pranavk at collabora.com>
Date:   Wed Apr 27 14:02:37 2016 +0530

    loleaflet: Prevent intermixing of multiple timeouts
    
    Clear a timeout before setting it.
    
    Change-Id: Ic808962b880a4c18b24e2f603dc1d351d65419ed

diff --git a/loleaflet/dist/toolbar/toolbar.js b/loleaflet/dist/toolbar/toolbar.js
index 841112f..91e6e08 100644
--- a/loleaflet/dist/toolbar/toolbar.js
+++ b/loleaflet/dist/toolbar/toolbar.js
@@ -170,6 +170,9 @@ var formatButtons = ['undo', 'redo', 'save',
 					 'fontcolor', 'backcolor', 'bullet', 'numbering', 'alignleft', 'alignhorizontal', 'alignright', 'alignblock',
 					 'incrementindent', 'decrementindent', 'insertgraphic'];
 
+var takeEditPopupMessage = '<div>You are viewing now.<br/>Click here to take edit</div>';
+var takeEditPopupTimeout = null;
+
 function onSearch(e) {
 	if (e.keyCode === 13) {
 		var toolbar = w2ui['toolbar-down'];
@@ -882,11 +885,14 @@ map.on('editlock', function (e) {
 		$('#takeeditlabel').html('VIEWING');
 		$('#tb_toolbar-down_item_takeedit')
 			.w2overlay({
-				html: '<div>You are viewing now.<br/>Click to take edit</div>',
+				html: takeEditPopupMessage,
 				style: 'padding: 5px'
 			});
-		setTimeout(function() {
+		clearTimeout(takeEditPopupTimeout);
+		takeEditPopupTimeout = setTimeout(function() {
 			$('#tb_toolbar-down_item_takeedit').w2overlay('');
+			clearTimeout(takeEditPopupTimeout);
+			takeEditPopupTimeout = null;
 		}, 3000);
 	}
 
@@ -906,11 +912,14 @@ map.on('mouseup keypress', function(e) {
 		$('#takeeditlabel').html('VIEWING');
 		$('#tb_toolbar-down_item_takeedit')
 			.w2overlay({
-				html: '<div>You are viewing now.<br/>Click to take edit</div>',
+				html: takeEditPopupMessage,
 				style: 'padding: 5px'
 			});
-		setTimeout(function() {
+		clearTimeout(takeEditPopupTimeout);
+		takeEditPopupTimeout = setTimeout(function() {
 			$('#tb_toolbar-down_item_takeedit').w2overlay('');
+			clearTimeout(takeEditPopupTimeout);
+			takeEditPopupTimeout = null;
 		}, 3000);
 	}
 });
commit f26900399d5dbd403c5b963b74d2fdb00b9fda1c
Author: Pranav Kant <pranavk at collabora.com>
Date:   Wed Apr 27 13:46:15 2016 +0530

    bccu#1745: Fix Calc blinking due to popup message
    
    Use w2overlay instead of w2popup. The former adjusts itself in
    the visible screen region and fixes, and does not introduce any
    additional scrollbars for the lifetime of the popup message.
    
    The w2overlay gets removed with mouse events. So instead of
    'mousedown' events originally, use 'mouseup', so that there is no
    succeeding mouse events to switch the overlay off.
    
    Also point the overlay pointer towards the button, not the label.
    
    Change-Id: Ic6c22fecc2e32075c27b6f4647373c28d2f635ae

diff --git a/loleaflet/dist/toolbar/toolbar.js b/loleaflet/dist/toolbar/toolbar.js
index 20d35a9..841112f 100644
--- a/loleaflet/dist/toolbar/toolbar.js
+++ b/loleaflet/dist/toolbar/toolbar.js
@@ -879,11 +879,14 @@ map.on('editlock', function (e) {
 		toolbar.uncheck('takeedit');
 		toolbar.enable('takeedit');
 		toolbar.set('takeedit', {hint: _('Take edit lock (others can only view)')});
-		$('#takeeditlabel')
-			.w2tag('You are viewing now')
-			.html('VIEWING');
+		$('#takeeditlabel').html('VIEWING');
+		$('#tb_toolbar-down_item_takeedit')
+			.w2overlay({
+				html: '<div>You are viewing now.<br/>Click to take edit</div>',
+				style: 'padding: 5px'
+			});
 		setTimeout(function() {
-			$('#takeeditlabel').w2tag('');
+			$('#tb_toolbar-down_item_takeedit').w2overlay('');
 		}, 3000);
 	}
 
@@ -898,13 +901,16 @@ map.on('editlock', function (e) {
 	});
 });
 
-map.on('mousedown keypress', function(e) {
+map.on('mouseup keypress', function(e) {
 	if (!map._editlock) {
-		$('#takeeditlabel')
-			.w2tag('Click to take edit')
-			.html('VIEWING');
+		$('#takeeditlabel').html('VIEWING');
+		$('#tb_toolbar-down_item_takeedit')
+			.w2overlay({
+				html: '<div>You are viewing now.<br/>Click to take edit</div>',
+				style: 'padding: 5px'
+			});
 		setTimeout(function() {
-			$('#takeeditlabel').w2tag('');
+			$('#tb_toolbar-down_item_takeedit').w2overlay('');
 		}, 3000);
 	}
 });


More information about the Libreoffice-commits mailing list