Skip to content

Commit 9d803b3

Browse files
committed
refactored js
1 parent 54d3e97 commit 9d803b3

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

build/ExportMap.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ExportMap.js

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -113,15 +113,17 @@ OpenLayers.Control.ExportMap = OpenLayers.Class(OpenLayers.Control, {
113113
};
114114
}
115115

116-
that.imagePromises.push(new Promise(function (resolve, reject) {
117-
that.loadImage(resolve, url)
118-
}));
116+
that.imagePromises.push(
117+
new Promise(function (resolve, reject) {
118+
that.loadImage(resolve, url)
119+
}));
119120
})
120121
});
121122

122-
Promise.all(this.imagePromises).then(function(){
123-
that.imagesLoaded();
124-
})
123+
Promise.all(this.imagePromises)
124+
.then(function(){
125+
that.drawLoadedImages()
126+
});
125127
},
126128
/**
127129
* A function to load the tile image from a URL. When all the images have been loaded
@@ -143,8 +145,12 @@ OpenLayers.Control.ExportMap = OpenLayers.Class(OpenLayers.Control, {
143145

144146
image.src = url;
145147
},
146-
147-
imagesLoaded: function () {
148+
/**
149+
* Draw the loaded images
150+
*
151+
* @private
152+
*/
153+
drawLoadedImages: function () {
148154
var that = this;
149155
this.canvasComponents.forEach(function (canvasComponent) {
150156
if (canvasComponent.toString().indexOf('HTMLCanvasElement') > -1) {

0 commit comments

Comments
 (0)