selectBox

This commit is contained in:
YouWei Zhao 2019-03-19 22:25:14 -04:00
parent 4fa318a6b4
commit b61a9afea8
7 changed files with 28 additions and 29 deletions

View File

@ -573,7 +573,7 @@ editor.prototype.setSelectBoxFromInfo=function(thisevent){
dataSelection.style.left = pos.x * 32 + 'px'; dataSelection.style.left = pos.x * 32 + 'px';
dataSelection.style.top = pos.y * ysize + 'px'; dataSelection.style.top = pos.y * ysize + 'px';
dataSelection.style.height = ysize - 6 + 'px'; dataSelection.style.height = ysize - 6 + 'px';
setTimeout(function(){selectBox.isSelected = true;}); setTimeout(function(){selectBox.isSelected(true);});
editor.info = JSON.parse(JSON.stringify(thisevent)); editor.info = JSON.parse(JSON.stringify(thisevent));
tip.infos = JSON.parse(JSON.stringify(thisevent)); tip.infos = JSON.parse(JSON.stringify(thisevent));
editor.pos=pos; editor.pos=pos;
@ -617,7 +617,7 @@ editor.prototype.listen = function () {
} }
if (unselect) { if (unselect) {
if (clickpath.indexOf('eui') === -1) { if (clickpath.indexOf('eui') === -1) {
if (selectBox.isSelected) { if (selectBox.isSelected()) {
editor_mode.onmode(''); editor_mode.onmode('');
editor.file.saveFloorFile(function (err) { editor.file.saveFloorFile(function (err) {
if (err) { if (err) {
@ -627,7 +627,7 @@ editor.prototype.listen = function () {
;printf('地图保存成功'); ;printf('地图保存成功');
}); });
} }
selectBox.isSelected = false; selectBox.isSelected(false);
editor.info = {}; editor.info = {};
} }
} }
@ -705,7 +705,7 @@ editor.prototype.listen = function () {
editor.showMidMenu(e.clientX,e.clientY); editor.showMidMenu(e.clientX,e.clientY);
return; return;
} }
if (!selectBox.isSelected) { if (!selectBox.isSelected()) {
var loc = eToLoc(e); var loc = eToLoc(e);
var pos = locToPos(loc,true); var pos = locToPos(loc,true);
editor_mode.onmode('nextChange'); editor_mode.onmode('nextChange');
@ -730,7 +730,7 @@ editor.prototype.listen = function () {
} }
eui.onmousemove = function (e) { eui.onmousemove = function (e) {
if (!selectBox.isSelected) { if (!selectBox.isSelected()) {
//tip.whichShow = 1; //tip.whichShow = 1;
return; return;
} }
@ -761,7 +761,7 @@ editor.prototype.listen = function () {
} }
eui.onmouseup = function (e) { eui.onmouseup = function (e) {
if (!selectBox.isSelected) { if (!selectBox.isSelected()) {
//tip.whichShow = 1; //tip.whichShow = 1;
return; return;
} }
@ -892,7 +892,7 @@ editor.prototype.listen = function () {
if (e.altKey && [48, 49, 50, 51, 52, 53, 54, 55, 56, 57].indexOf(e.keyCode) !== -1) if (e.altKey && [48, 49, 50, 51, 52, 53, 54, 55, 56, 57].indexOf(e.keyCode) !== -1)
e.preventDefault(); e.preventDefault();
//Ctrl+z 撤销上一步undo //Ctrl+z 撤销上一步undo
if (e.keyCode == 90 && e.ctrlKey && editor.preMapData && currDrawData.pos.length && selectBox.isSelected) { if (e.keyCode == 90 && e.ctrlKey && editor.preMapData && currDrawData.pos.length && selectBox.isSelected()) {
editor.map = JSON.parse(JSON.stringify(editor.preMapData.map)); editor.map = JSON.parse(JSON.stringify(editor.preMapData.map));
editor.fgmap = JSON.parse(JSON.stringify(editor.preMapData.fgmap)); editor.fgmap = JSON.parse(JSON.stringify(editor.preMapData.fgmap));
editor.bgmap = JSON.parse(JSON.stringify(editor.preMapData.bgmap)); editor.bgmap = JSON.parse(JSON.stringify(editor.preMapData.bgmap));
@ -902,7 +902,7 @@ editor.prototype.listen = function () {
editor.preMapData = null; editor.preMapData = null;
} }
//Ctrl+y 重做一步redo //Ctrl+y 重做一步redo
if (e.keyCode == 89 && e.ctrlKey && reDo && reDo.pos.length && selectBox.isSelected) { if (e.keyCode == 89 && e.ctrlKey && reDo && reDo.pos.length && selectBox.isSelected()) {
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}));
for (var j = 0; j < reDo.pos.length; j++) for (var j = 0; j < reDo.pos.length; j++)
editor.map[reDo.pos[j].y][reDo.pos[j].x] = JSON.parse(JSON.stringify(reDo.info)); editor.map[reDo.pos[j].y][reDo.pos[j].x] = JSON.parse(JSON.stringify(reDo.info));
@ -1024,7 +1024,7 @@ editor.prototype.listen = function () {
} else if ((pos.y + 1) * ysize > editor.widthsX[spriter][3]) } else if ((pos.y + 1) * ysize > editor.widthsX[spriter][3])
pos.y = ~~(editor.widthsX[spriter][3] / ysize) - 1; pos.y = ~~(editor.widthsX[spriter][3] / ysize) - 1;
selectBox.isSelected = true; selectBox.isSelected(true);
// console.log(pos,core.material.images[pos.images].height) // console.log(pos,core.material.images[pos.images].height)
dataSelection.style.left = pos.x * 32 + 'px'; dataSelection.style.left = pos.x * 32 + 'px';
dataSelection.style.top = pos.y * ysize + 'px'; dataSelection.style.top = pos.y * ysize + 'px';
@ -1127,7 +1127,7 @@ editor.prototype.listen = function () {
chooseThis.onmousedown = function(e){ chooseThis.onmousedown = function(e){
editor.hideMidMenu(); editor.hideMidMenu();
e.stopPropagation(); e.stopPropagation();
selectBox.isSelected = false; selectBox.isSelected(false);
editor_mode.onmode('nextChange'); editor_mode.onmode('nextChange');
editor_mode.onmode('loc'); editor_mode.onmode('loc');

View File

@ -512,7 +512,7 @@ function omitedcheckUpdateFunction(event) {
var blocklyWidgetDiv = document.getElementsByClassName('blocklyWidgetDiv'); var blocklyWidgetDiv = document.getElementsByClassName('blocklyWidgetDiv');
editor_blockly.show = function () { editor_blockly.show = function () {
if (typeof(selectBox) !== typeof(undefined)) selectBox.isSelected = false; if (typeof(selectBox) !== typeof(undefined)) selectBox.isSelected(false);
document.getElementById('left6').style = ''; document.getElementById('left6').style = '';
for (var ii = 0, node; node = blocklyWidgetDiv[ii]; ii++) { for (var ii = 0, node; node = blocklyWidgetDiv[ii]; ii++) {
node.style.zIndex = 201; node.style.zIndex = 201;

View File

@ -410,7 +410,7 @@ editor_mode = function (editor) {
if (editor_mode[mode]) editor_mode[mode](); if (editor_mode[mode]) editor_mode[mode]();
document.getElementById('editModeSelect').value = mode; document.getElementById('editModeSelect').value = mode;
var tips = tip_in_showMode; var tips = tip_in_showMode;
if (!selectBox.isSelected) printf('tips: ' + tips[~~(tips.length * Math.random())]); if (!selectBox.isSelected()) printf('tips: ' + tips[~~(tips.length * Math.random())]);
} }
editor_mode.prototype.loc = function (callback) { editor_mode.prototype.loc = function (callback) {

View File

@ -39,7 +39,7 @@ editor_multi = function () {
editor_multi.lintAutocomplete = false; editor_multi.lintAutocomplete = false;
editor_multi.show = function () { editor_multi.show = function () {
if (typeof(selectBox) !== typeof(undefined)) selectBox.isSelected = false; if (typeof(selectBox) !== typeof(undefined)) selectBox.isSelected(false);
var valueNow = codeEditor.getValue(); var valueNow = codeEditor.getValue();
//try{eval('function _asdygakufyg_() { return '+valueNow+'\n}');editor_multi.lintAutocomplete=true;}catch(ee){} //try{eval('function _asdygakufyg_() { return '+valueNow+'\n}');editor_multi.lintAutocomplete=true;}catch(ee){}
if (valueNow.slice(0, 8) === 'function') editor_multi.lintAutocomplete = true; if (valueNow.slice(0, 8) === 'function') editor_multi.lintAutocomplete = true;

View File

@ -185,7 +185,7 @@ deleteMap.onclick=function () {
else printe('删除成功,请F5刷新编辑器生效'); else printe('删除成功,请F5刷新编辑器生效');
} }
printf = function (str_, type) { printf = function (str_, type) {
selectBox.isSelected = false; selectBox.isSelected(false);
if (!type) { if (!type) {
tip.whichShow = 11; tip.whichShow = 11;
} else { } else {
@ -279,18 +279,17 @@ var tip = new Vue({
} }
} }
}) })
var selectBox=document.getElementById('selectBox')
var selectBox = new Vue({ var dataSelection=document.getElementById('dataSelection')
el: '#selectBox', selectBox._isSelected=false
data: { selectBox.isSelected=function(value){
isSelected: false if(value!=null){
}, selectBox._isSelected=value;
watch: { tip.isSelectedBlock = value;
isSelected: function () { tip.whichShow = 0;
tip.isSelectedBlock = this.isSelected; clearTimeout(tip.timer);
tip.whichShow = 0; dataSelection.style.display=value?'':'none'
clearTimeout(tip.timer);
}
} }
}) return selectBox._isSelected
}

View File

@ -277,7 +277,7 @@
<div id="iconLib"> <div id="iconLib">
<div id="iconImages"></div> <div id="iconImages"></div>
<div id="selectBox"> <div id="selectBox">
<div id='dataSelection' v-show="isSelected" v-cloak></div> <div id='dataSelection' style="display:none"></div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -325,7 +325,7 @@
<div id="iconLib"> <div id="iconLib">
<div id="iconImages"></div> <div id="iconImages"></div>
<div id="selectBox"> <div id="selectBox">
<div id='dataSelection' v-show="isSelected" v-cloak></div> <div id='dataSelection' style="display:none"></div>
</div> </div>
</div> </div>
</div> </div>