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

Marco Cecchetti (via logerrit) logerrit at kemper.freedesktop.org
Tue Oct 22 11:51:33 UTC 2019


 loleaflet/src/control/ColorPicker.js             |    8 ++++++++
 loleaflet/src/control/Control.JSDialogBuilder.js |    8 ++++++--
 2 files changed, 14 insertions(+), 2 deletions(-)

New commits:
commit 02fe006eade4d20f2a296b16687a7d3839dfaf3c
Author:     Marco Cecchetti <marco.cecchetti at collabora.com>
AuthorDate: Tue Oct 22 13:47:55 2019 +0200
Commit:     Marco Cecchetti <marco.cecchetti at collabora.com>
CommitDate: Tue Oct 22 13:50:57 2019 +0200

    loleaflet: color picker: on open show the tint set with selected tint
    
    Change-Id: Ia69b40aac7287a9472050733e032abc600175bd5

diff --git a/loleaflet/src/control/ColorPicker.js b/loleaflet/src/control/ColorPicker.js
index 4a820df70..2826e93ba 100644
--- a/loleaflet/src/control/ColorPicker.js
+++ b/loleaflet/src/control/ColorPicker.js
@@ -48,6 +48,7 @@ L.ColorPicker = L.Class.extend({
 		this._selectedColor = this.options.selectedColor;
 		this._initIndexes();
 		this._container = this._createControl();
+		this._initialized = true;
 	},
 
 	getId: function () {
@@ -62,6 +63,13 @@ L.ColorPicker = L.Class.extend({
 		return this._container;
 	},
 
+	onShow: function () {
+		if (!this._initialized || this._selectedColor === '#')
+			return;
+		this._initIndexes();
+		this._updateTintsView();
+	},
+
 	_initIndexes: function () {
 		for (var i = 0; i < this._getBasicColorCount(); ++i) {
 			var tintSet = this._getTintSet(i);
diff --git a/loleaflet/src/control/Control.JSDialogBuilder.js b/loleaflet/src/control/Control.JSDialogBuilder.js
index 997bc51a6..210d528db 100644
--- a/loleaflet/src/control/Control.JSDialogBuilder.js
+++ b/loleaflet/src/control/Control.JSDialogBuilder.js
@@ -210,7 +210,11 @@ L.Control.JSDialogBuilder = L.Control.extend({
 
 		$(contentDiv).hide();
 		if (builder.wizard) {
-			$(sectionTitle).click(function() { builder.wizard.goLevelDown(contentDiv); });
+			$(sectionTitle).click(function() {
+				builder.wizard.goLevelDown(contentDiv);
+				if (contentNode.onshow)
+					contentNode.onshow();
+			});
 		} else {
 			console.debug('Builder used outside of mobile wizard: please implement the click handler');
 		}
@@ -691,7 +695,7 @@ L.Control.JSDialogBuilder = L.Control.extend({
 		// color control panel
 		var colorsContainer = colorPickerControl.getContainer();
 
-		var contentNode = {type: 'container', children: [colorsContainer]};
+		var contentNode = {type: 'container', children: [colorsContainer], onshow: L.bind(colorPickerControl.onShow, colorPickerControl)};
 
 		builder._explorableEntry(parentContainer, title, contentNode, builder, valueNode, iconPath);
 		return false;


More information about the Libreoffice-commits mailing list