Repository: incubator-guacamole-client Updated Branches: refs/heads/master ae7d57b3c -> 95968016c
GUACAMOLE-250: Store image URL in client state only if such an image can be generated (non-zero width/height). Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/4582f123 Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/4582f123 Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/4582f123 Branch: refs/heads/master Commit: 4582f123c3710c31231fd196711f8641edf4b27e Parents: ae7d57b Author: Michael Jumper <[email protected]> Authored: Wed Apr 12 22:15:22 2017 -0700 Committer: Michael Jumper <[email protected]> Committed: Wed Apr 12 23:05:52 2017 -0700 ---------------------------------------------------------------------- .../src/main/webapp/modules/Client.js | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/4582f123/guacamole-common-js/src/main/webapp/modules/Client.js ---------------------------------------------------------------------- diff --git a/guacamole-common-js/src/main/webapp/modules/Client.js b/guacamole-common-js/src/main/webapp/modules/Client.js index 68d218d..d4b3b7e 100644 --- a/guacamole-common-js/src/main/webapp/modules/Client.js +++ b/guacamole-common-js/src/main/webapp/modules/Client.js @@ -158,13 +158,16 @@ Guacamole.Client = function(tunnel) { var layer = layers[key]; var canvas = layer.toCanvas(); - // Store common layer/buffer data (dimensions and image contents) + // Store layer/buffer dimensions var exportLayer = { 'width' : layer.width, - 'height' : layer.height, - 'url' : canvas.toDataURL('image/png') + 'height' : layer.height }; + // 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 if (index > 0) { exportLayer.x = layer.x; @@ -223,10 +226,14 @@ Guacamole.Client = function(tunnel) { var importLayer = state.layers[key]; var layer = getLayer(index); - // Initialize new layer with imported data + // Reset layer size 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 if (index > 0 && importLayer.parent >= 0) {
