Sha256: 4dd797d61cff3a00b7ecb363ab2d4150e903da8eefbc11ec093f087a331e988b
Contents?: true
Size: 1.21 KB
Versions: 13
Compression:
Stored size: 1.21 KB
Contents
pageflow.linkmapPage.RemoteImage = (function() { function RemoteImage(url, image) { this.width = function() { return image.width; }; this.height = function() { return image.height; }; this.draw = function(context, options) { if (options.disableImageSmoothing) { context.imageSmoothingEnabled = false; } context.drawImage(image, 0, 0, options.width, image.height * (options.width / image.width)); }; } RemoteImage.load = function(url) { return new $.Deferred(function(deferred) { var image = new Image(); image.onload = onLoad; image.onerror = onError; image.crossOrigin = 'Anonymous'; image.src = url; function onLoad() { deferred.resolve(new pageflow.linkmapPage.RemoteImage(url, image)); } function onError() { deferred.reject(loadError(url)); } }).promise(); }; return RemoteImage; function loadError(url) { var error = new Error('Error while loading ' + url + '.'); error.i18nKey = 'pageflow.linkmap_page.errors.loading_remote_image_failed'; return error; } }());
Version data entries
13 entries across 13 versions & 1 rubygems