preventDefault

This commit is contained in:
oc 2019-06-08 20:56:51 +08:00
parent 9f96a841fb
commit 1d756fd223

View File

@ -123,7 +123,7 @@ editor.constructor.prototype.listen=function () {
var loc = eToLoc(e); var loc = eToLoc(e);
var pos = locToPos(loc,true); var pos = locToPos(loc,true);
editor.showMidMenu(e.clientX,e.clientY); editor.showMidMenu(e.clientX,e.clientY);
return; return false;
} }
if (!selectBox.isSelected()) { if (!selectBox.isSelected()) {
var loc = eToLoc(e); var loc = eToLoc(e);
@ -137,20 +137,19 @@ editor.constructor.prototype.listen=function () {
uc.strokeStyle = '#FF0000'; uc.strokeStyle = '#FF0000';
uc.lineWidth = 3; uc.lineWidth = 3;
if(editor.isMobile)editor.showMidMenu(e.clientX,e.clientY); if(editor.isMobile)editor.showMidMenu(e.clientX,e.clientY);
return; return false;
} }
holdingPath = 1; holdingPath = 1;
mouseOutCheck = 2; mouseOutCheck = 2;
setTimeout(clear1); setTimeout(clear1);
e.stopPropagation();
uc.clearRect(0, 0, core.__PIXELS__, core.__PIXELS__); uc.clearRect(0, 0, core.__PIXELS__, core.__PIXELS__);
var loc = eToLoc(e); var loc = eToLoc(e);
var pos = locToPos(loc,true); var pos = locToPos(loc,true);
stepPostfix = []; stepPostfix = [];
stepPostfix.push(pos); stepPostfix.push(pos);
fillPos(pos); fillPos(pos);
return false;
} }
eui.onmousemove = function (e) { eui.onmousemove = function (e) {
@ -178,14 +177,13 @@ editor.constructor.prototype.listen=function () {
//editor_mode.loc(); //editor_mode.loc();
//tip.whichShow(1); //tip.whichShow(1);
// tip.showHelp(6); // tip.showHelp(6);
return; return false;
} }
if (holdingPath == 0) { if (holdingPath == 0) {
return; return false;
} }
mouseOutCheck = 2; mouseOutCheck = 2;
e.stopPropagation();
var loc = eToLoc(e); var loc = eToLoc(e);
var pos = locToPos(loc,true); var pos = locToPos(loc,true);
var pos0 = stepPostfix[stepPostfix.length - 1] var pos0 = stepPostfix[stepPostfix.length - 1]
@ -204,6 +202,7 @@ editor.constructor.prototype.listen=function () {
stepPostfix.push(pos); stepPostfix.push(pos);
fillPos(pos); fillPos(pos);
} }
return false;
} }
eui.onmouseup = function (e) { eui.onmouseup = function (e) {
@ -213,10 +212,9 @@ editor.constructor.prototype.listen=function () {
editor.exchangePos(startPos, endPos); editor.exchangePos(startPos, endPos);
startPos = endPos = null; startPos = endPos = null;
uc.clearRect(0, 0, core.__PIXELS__, core.__PIXELS__); uc.clearRect(0, 0, core.__PIXELS__, core.__PIXELS__);
return; return false;
} }
holdingPath = 0; holdingPath = 0;
e.stopPropagation();
if (stepPostfix && stepPostfix.length) { if (stepPostfix && stepPostfix.length) {
editor.preMapData = JSON.parse(JSON.stringify({map:editor.map,fgmap:editor.fgmap,bgmap:editor.bgmap})); editor.preMapData = JSON.parse(JSON.stringify({map:editor.map,fgmap:editor.fgmap,bgmap:editor.bgmap}));
if(editor.brushMod!=='line'){ if(editor.brushMod!=='line'){
@ -259,6 +257,7 @@ editor.constructor.prototype.listen=function () {
stepPostfix = []; stepPostfix = [];
uc.clearRect(0, 0, core.__PIXELS__, core.__PIXELS__); uc.clearRect(0, 0, core.__PIXELS__, core.__PIXELS__);
} }
return false;
} }
/* /*
@ -280,7 +279,6 @@ editor.constructor.prototype.listen=function () {
*/ */
document.getElementById('mid').onmousewheel = function (e) { document.getElementById('mid').onmousewheel = function (e) {
e.preventDefault();
var wheel = function (direct) { var wheel = function (direct) {
var index=editor.core.floorIds.indexOf(editor.currentFloorId); var index=editor.core.floorIds.indexOf(editor.currentFloorId);
var toId = editor.currentFloorId; var toId = editor.currentFloorId;
@ -306,6 +304,7 @@ editor.constructor.prototype.listen=function () {
catch (ee) { catch (ee) {
console.log(ee); console.log(ee);
} }
return false;
} }
editor.preMapData = null; editor.preMapData = null;