From 21ab8a44509ef3b9491a70eafd58c413b3f856fa Mon Sep 17 00:00:00 2001 From: YouWei Zhao Date: Thu, 27 Sep 2018 18:48:52 +0800 Subject: [PATCH] editor-airwall --- _server/editor.js | 12 ++++++++++++ editor-mobile.html | 2 ++ editor.html | 2 ++ 3 files changed, 16 insertions(+) diff --git a/_server/editor.js b/_server/editor.js index 7ef50d6a..07ed8fb8 100644 --- a/_server/editor.js +++ b/_server/editor.js @@ -366,6 +366,18 @@ editor.prototype.drawInitData = function (icons) { for (var ii = 0; ii < imgNames.length; ii++) { var img = imgNames[ii]; if (img == 'terrains') { + (function(image,dc,nowx){ + if (image.complete) { + dc.drawImage(image, nowx, 32); + core.material.images.airwall = image; + delete(editor.airwallImg); + } else image.onload = function () { + dc.drawImage(image, nowx, 32); + core.material.images.airwall = image; + delete(editor.airwallImg); + editor.updateMap(); + } + })(editor.airwallImg,dc,nowx); dc.drawImage(images[img], nowx, 32*2); nowx += images[img].width; continue; diff --git a/editor-mobile.html b/editor-mobile.html index 75c4de36..3f656e78 100644 --- a/editor-mobile.html +++ b/editor-mobile.html @@ -451,6 +451,8 @@ if (location.protocol.indexOf("http")!=0) { var useCompress = main.useCompress; main.useCompress = false; + editor.airwallImg = new Image(); + editor.airwallImg.src = './project/images/airwall.png'; main.init('editor', function () { editor.init(function () { editor.useCompress = useCompress; diff --git a/editor.html b/editor.html index 90c2716f..f3d9b16f 100644 --- a/editor.html +++ b/editor.html @@ -435,6 +435,8 @@ if (location.protocol.indexOf("http")!=0) {