Store command values for colors immediately on set.
Avoids needing to wait for a notification - if it ever comes. Change-Id: I3d7118fa4682ebfe908dee11cdd123aafc68bd89 Reviewed-on: https://gerrit.libreoffice.org/c/online/+/91150 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
This commit is contained in:
parent
5766ed7706
commit
32288ab908
2 changed files with 17 additions and 4 deletions
|
@ -1309,7 +1309,7 @@ L.Control.JSDialogBuilder = L.Control.extend({
|
|||
return false;
|
||||
},
|
||||
|
||||
_getColorCommandToSend: function(builder, data, color) {
|
||||
_sendColorCommand: function(builder, data, color) {
|
||||
var gradientItem;
|
||||
|
||||
if (data.id === 'fillgrad1') {
|
||||
|
@ -1322,7 +1322,13 @@ L.Control.JSDialogBuilder = L.Control.extend({
|
|||
return '.uno:FillGradient?FillGradientJSON:string=' + JSON.stringify(gradientItem);
|
||||
}
|
||||
|
||||
return data.command + '?Color:string=' + color;
|
||||
var command = data.command + '?Color:string=' + color;
|
||||
|
||||
// update the item state as we send
|
||||
var items = builder.map['stateChangeHandler'];
|
||||
items.setItemValue(data.command, parseInt('0x' + color));
|
||||
|
||||
builder.map.sendUnoCommand(command);
|
||||
},
|
||||
|
||||
_getDefaultColorForCommand: function(command) {
|
||||
|
@ -1381,8 +1387,7 @@ L.Control.JSDialogBuilder = L.Control.extend({
|
|||
var noColorControl = (data.command !== '.uno:FontColor' && data.command !== '.uno:Color');
|
||||
|
||||
var callback = function(color) {
|
||||
var command = builder._getColorCommandToSend(builder, data, color);
|
||||
builder.map.sendUnoCommand(command);
|
||||
builder._sendColorCommand(builder, data, color);
|
||||
};
|
||||
|
||||
var colorPickerControl = new L.ColorPicker(
|
||||
|
|
|
@ -64,6 +64,14 @@ L.Map.StateChangeHandler = L.Handler.extend({
|
|||
}
|
||||
|
||||
return this._items[unoCmd];
|
||||
},
|
||||
|
||||
setItemValue: function(unoCmd, value) {
|
||||
if (unoCmd && unoCmd.substring(0, 5) !== '.uno:') {
|
||||
unoCmd = '.uno:' + unoCmd;
|
||||
}
|
||||
|
||||
this._items[unoCmd] = value;
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue