diff --git a/_server/editor.js b/_server/editor.js
index 0e0cb653..b76134b0 100644
--- a/_server/editor.js
+++ b/_server/editor.js
@@ -1,6 +1,7 @@
function editor() {
this.version = "2.0";
this.material = {};
+ this.brushMod = "line";//["line","rectangle"]
}
editor.prototype.init = function (callback) {
@@ -503,6 +504,20 @@ editor.prototype.listen = function () {
e.stopPropagation();
if (stepPostfix && stepPostfix.length) {
preMapData = JSON.parse(JSON.stringify(editor.map));
+ if(editor.brushMod==='rectangle'){
+ var x0=stepPostfix[0].x;
+ var y0=stepPostfix[0].y;
+ var x1=stepPostfix[stepPostfix.length-1].x;
+ var y1=stepPostfix[stepPostfix.length-1].y;
+ if(x0>x1){x0^=x1;x1^=x0;x0^=x1;}//swap
+ if(y0>y1){y0^=y1;y1^=y0;y0^=y1;}//swap
+ stepPostfix=[];
+ for(var ii=x0;ii<=x1;ii++){
+ for(var jj=y0;jj<=y1;jj++){
+ stepPostfix.push({x:ii,y:jj})
+ }
+ }
+ }
currDrawData.pos = JSON.parse(JSON.stringify(stepPostfix));
currDrawData.info = JSON.parse(JSON.stringify(editor.info));
reDo = null;
@@ -839,6 +854,16 @@ editor.prototype.listen = function () {
});
}
+ var brushMod=document.getElementById('brushMod');
+ brushMod.onchange=function(){
+ editor.brushMod=brushMod.value;
+ }
+
+ var brushMod2=document.getElementById('brushMod2');
+ if(brushMod2)brushMod2.onchange=function(){
+ editor.brushMod=brushMod2.value;
+ }
+
}//绑定事件
/*
diff --git a/_server/vm.js b/_server/vm.js
index 4e70722b..312507fa 100644
--- a/_server/vm.js
+++ b/_server/vm.js
@@ -24,7 +24,7 @@ document.body.onmousedown = function (e) {
}
});
- if (clickpath.indexOf('edit') === -1 && clickpath.indexOf('tip') === -1) {
+ if (clickpath.indexOf('edit') === -1 && clickpath.indexOf('tip') === -1 && clickpath.indexOf('brushMod') === -1 && clickpath.indexOf('brushMod2') === -1) {
if (clickpath.indexOf('eui') === -1) {
if (selectBox.isSelected) {
editor_mode.onmode('');
diff --git a/editor-mobile.html b/editor-mobile.html
index 8d22e24f..21c1a885 100644
--- a/editor-mobile.html
+++ b/editor-mobile.html
@@ -264,6 +264,10 @@
+
diff --git a/editor.html b/editor.html
index cff39acc..20d3a0cf 100644
--- a/editor.html
+++ b/editor.html
@@ -236,8 +236,10 @@
-
-
+
+ 画线
+ 画矩形
+