mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUACAMOLE-250: Store image URL in client state only if such an image can be generated (non-zero width/height).
This commit is contained in:
@@ -158,13 +158,16 @@ Guacamole.Client = function(tunnel) {
|
|||||||
var layer = layers[key];
|
var layer = layers[key];
|
||||||
var canvas = layer.toCanvas();
|
var canvas = layer.toCanvas();
|
||||||
|
|
||||||
// Store common layer/buffer data (dimensions and image contents)
|
// Store layer/buffer dimensions
|
||||||
var exportLayer = {
|
var exportLayer = {
|
||||||
'width' : layer.width,
|
'width' : layer.width,
|
||||||
'height' : layer.height,
|
'height' : layer.height
|
||||||
'url' : canvas.toDataURL('image/png')
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Store layer/buffer image data, if it can be generated
|
||||||
|
if (layer.width && layer.height)
|
||||||
|
exportLayer.url = canvas.toDataURL('image/png');
|
||||||
|
|
||||||
// Add layer properties if not a buffer nor the default layer
|
// Add layer properties if not a buffer nor the default layer
|
||||||
if (index > 0) {
|
if (index > 0) {
|
||||||
exportLayer.x = layer.x;
|
exportLayer.x = layer.x;
|
||||||
@@ -223,10 +226,14 @@ Guacamole.Client = function(tunnel) {
|
|||||||
var importLayer = state.layers[key];
|
var importLayer = state.layers[key];
|
||||||
var layer = getLayer(index);
|
var layer = getLayer(index);
|
||||||
|
|
||||||
// Initialize new layer with imported data
|
// Reset layer size
|
||||||
display.resize(layer, importLayer.width, importLayer.height);
|
display.resize(layer, importLayer.width, importLayer.height);
|
||||||
display.setChannelMask(layer, Guacamole.Layer.SRC);
|
|
||||||
display.draw(layer, 0, 0, importLayer.url);
|
// Initialize new layer if it has associated data
|
||||||
|
if (importLayer.url) {
|
||||||
|
display.setChannelMask(layer, Guacamole.Layer.SRC);
|
||||||
|
display.draw(layer, 0, 0, importLayer.url);
|
||||||
|
}
|
||||||
|
|
||||||
// Set layer-specific properties if not a buffer nor the default layer
|
// Set layer-specific properties if not a buffer nor the default layer
|
||||||
if (index > 0 && importLayer.parent >= 0) {
|
if (index > 0 && importLayer.parent >= 0) {
|
||||||
|
Reference in New Issue
Block a user