右键复制粘贴事件
This commit is contained in:
parent
b2b60b133e
commit
9f42963db8
@ -20,7 +20,7 @@ function editor() {
|
|||||||
chooseThis : document.getElementById('chooseThis'),
|
chooseThis : document.getElementById('chooseThis'),
|
||||||
chooseInRight : document.getElementById('chooseInRight'),
|
chooseInRight : document.getElementById('chooseInRight'),
|
||||||
copyLoc : document.getElementById('copyLoc'),
|
copyLoc : document.getElementById('copyLoc'),
|
||||||
moveLoc : document.getElementById('moveLoc'),
|
pasteLoc : document.getElementById('pasteLoc'),
|
||||||
clearEvent : document.getElementById('clearEvent'),
|
clearEvent : document.getElementById('clearEvent'),
|
||||||
clearLoc : document.getElementById('clearLoc'),
|
clearLoc : document.getElementById('clearLoc'),
|
||||||
brushMod:document.getElementById('brushMod'),
|
brushMod:document.getElementById('brushMod'),
|
||||||
@ -80,9 +80,6 @@ function editor() {
|
|||||||
scrollBarHeight :0,
|
scrollBarHeight :0,
|
||||||
folded:false,
|
folded:false,
|
||||||
foldPerCol: 50,
|
foldPerCol: 50,
|
||||||
// 画图区菜单
|
|
||||||
lastRightButtonPos:[{x:0,y:0},{x:0,y:0}],
|
|
||||||
lastCopyedInfo : [null, null],
|
|
||||||
//
|
//
|
||||||
ratio : 1,
|
ratio : 1,
|
||||||
// blockly转义
|
// blockly转义
|
||||||
|
|||||||
@ -32,7 +32,7 @@ editor_listen_wrapper = function (editor) {
|
|||||||
editor.dom.chooseThis.onmousedown = editor.uifunctions.chooseThis_click
|
editor.dom.chooseThis.onmousedown = editor.uifunctions.chooseThis_click
|
||||||
editor.dom.chooseInRight.onmousedown = editor.uifunctions.chooseInRight_click
|
editor.dom.chooseInRight.onmousedown = editor.uifunctions.chooseInRight_click
|
||||||
editor.dom.copyLoc.onmousedown = editor.uifunctions.copyLoc_click
|
editor.dom.copyLoc.onmousedown = editor.uifunctions.copyLoc_click
|
||||||
editor.dom.moveLoc.onmousedown = editor.uifunctions.moveLoc_click
|
editor.dom.pasteLoc.onmousedown = editor.uifunctions.pasteLoc_click
|
||||||
editor.dom.clearEvent.onmousedown = editor.uifunctions.clearEvent_click
|
editor.dom.clearEvent.onmousedown = editor.uifunctions.clearEvent_click
|
||||||
editor.dom.clearLoc.onmousedown = editor.uifunctions.clearLoc_click
|
editor.dom.clearLoc.onmousedown = editor.uifunctions.clearLoc_click
|
||||||
|
|
||||||
@ -130,8 +130,8 @@ editor_listen_wrapper = function (editor) {
|
|||||||
editor.dom.chooseInRight.onmousedown = null
|
editor.dom.chooseInRight.onmousedown = null
|
||||||
editor.dom.copyLoc.ontouchstart = editor.dom.copyLoc.onmousedown
|
editor.dom.copyLoc.ontouchstart = editor.dom.copyLoc.onmousedown
|
||||||
editor.dom.copyLoc.onmousedown = null
|
editor.dom.copyLoc.onmousedown = null
|
||||||
editor.dom.moveLoc.ontouchstart = editor.dom.moveLoc.onmousedown
|
editor.dom.pasteLoc.ontouchstart = editor.dom.pasteLoc.onmousedown
|
||||||
editor.dom.moveLoc.onmousedown = null
|
editor.dom.pasteLoc.onmousedown = null
|
||||||
editor.dom.clearLoc.ontouchstart = editor.dom.clearLoc.onmousedown
|
editor.dom.clearLoc.ontouchstart = editor.dom.clearLoc.onmousedown
|
||||||
editor.dom.clearLoc.onmousedown = null
|
editor.dom.clearLoc.onmousedown = null
|
||||||
|
|
||||||
|
|||||||
@ -342,12 +342,7 @@ editor_mappanel_wrapper = function (editor) {
|
|||||||
* 显示右键菜单
|
* 显示右键菜单
|
||||||
*/
|
*/
|
||||||
editor.uifunctions.showMidMenu = function (x, y) {
|
editor.uifunctions.showMidMenu = function (x, y) {
|
||||||
editor.uivalues.lastRightButtonPos = JSON.parse(JSON.stringify(
|
|
||||||
[editor.pos, editor.uivalues.lastRightButtonPos[0]]
|
|
||||||
));
|
|
||||||
// --- copy
|
// --- copy
|
||||||
editor.uivalues.lastCopyedInfo = [editor.copyFromPos(), editor.uivalues.lastCopyedInfo[0]];
|
|
||||||
var locStr = '(' + editor.uivalues.lastRightButtonPos[1].x + ',' + editor.uivalues.lastRightButtonPos[1].y + ')';
|
|
||||||
var scrollLeft = document.documentElement.scrollLeft || document.body.scrollLeft;
|
var scrollLeft = document.documentElement.scrollLeft || document.body.scrollLeft;
|
||||||
var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
|
var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
|
||||||
|
|
||||||
@ -386,8 +381,8 @@ editor_mappanel_wrapper = function (editor) {
|
|||||||
else editor.dom.extraEvent.style.display = 'none';
|
else editor.dom.extraEvent.style.display = 'none';
|
||||||
|
|
||||||
editor.dom.chooseThis.children[0].innerHTML = '选中此点' + '(' + editor.pos.x + ',' + editor.pos.y + ')'
|
editor.dom.chooseThis.children[0].innerHTML = '选中此点' + '(' + editor.pos.x + ',' + editor.pos.y + ')'
|
||||||
editor.dom.copyLoc.children[0].innerHTML = '复制事件' + locStr + '到此处';
|
editor.dom.copyLoc.children[0].innerHTML = '复制此事件';
|
||||||
editor.dom.moveLoc.children[0].innerHTML = '交换事件' + locStr + '与此事件的位置';
|
editor.dom.pasteLoc.children[0].innerHTML = '粘贴到此事件';
|
||||||
editor.dom.midMenu.style = 'top:' + (y + scrollTop) + 'px;left:' + (x + scrollLeft) + 'px;';
|
editor.dom.midMenu.style = 'top:' + (y + scrollTop) + 'px;left:' + (x + scrollLeft) + 'px;';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -568,34 +563,39 @@ editor_mappanel_wrapper = function (editor) {
|
|||||||
editor.uifunctions.copyLoc_click = function (e) {
|
editor.uifunctions.copyLoc_click = function (e) {
|
||||||
editor.uifunctions.hideMidMenu();
|
editor.uifunctions.hideMidMenu();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
e.preventDefault();
|
||||||
|
editor_mode.onmode('');
|
||||||
|
editor.uivalues.copyedInfo = editor.copyFromPos();
|
||||||
|
printf('该点事件已复制');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* editor.dom.pasteLoc.onmousedown
|
||||||
|
* 菜单 移动此事件
|
||||||
|
*/
|
||||||
|
editor.uifunctions.pasteLoc_click = function (e) {
|
||||||
|
editor.uifunctions.hideMidMenu();
|
||||||
|
e.stopPropagation();
|
||||||
|
e.preventDefault();
|
||||||
|
if (!editor.uivalues.copyedInfo) {
|
||||||
|
printe("没有复制的事件");
|
||||||
|
return;
|
||||||
|
}
|
||||||
editor.savePreMap();
|
editor.savePreMap();
|
||||||
editor_mode.onmode('');
|
editor_mode.onmode('');
|
||||||
var now = editor.pos, last = editor.uivalues.lastRightButtonPos[1];
|
editor.pasteToPos(editor.uivalues.copyedInfo);
|
||||||
if (now.x == last.x && now.y == last.y) return;
|
|
||||||
editor.pasteToPos(editor.uivalues.lastCopyedInfo[1]);
|
|
||||||
editor.updateMap();
|
editor.updateMap();
|
||||||
editor.file.saveFloorFile(function (err) {
|
editor.file.saveFloorFile(function (err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
printe(err);
|
printe(err);
|
||||||
throw (err)
|
throw (err)
|
||||||
}
|
}
|
||||||
; printf('复制事件成功');
|
; printf('粘贴到事件成功');
|
||||||
editor.uifunctions.unhighlightSaveFloorButton();
|
editor.uifunctions.unhighlightSaveFloorButton();
|
||||||
editor.drawPosSelection();
|
editor.drawPosSelection();
|
||||||
});
|
});
|
||||||
}
|
return;
|
||||||
|
|
||||||
/**
|
|
||||||
* editor.dom.moveLoc.onmousedown
|
|
||||||
* 菜单 移动此事件
|
|
||||||
*/
|
|
||||||
editor.uifunctions.moveLoc_click = function (e) {
|
|
||||||
editor.uifunctions.hideMidMenu();
|
|
||||||
e.stopPropagation();
|
|
||||||
editor.savePreMap();
|
|
||||||
editor_mode.onmode('');
|
|
||||||
editor.exchangePos(editor.pos, editor.uivalues.lastRightButtonPos[1]);
|
|
||||||
editor.uifunctions.unhighlightSaveFloorButton();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -367,7 +367,7 @@
|
|||||||
<div id='chooseThis' class="menuitem"><div class="menuitem-content">选中此点</div></div>
|
<div id='chooseThis' class="menuitem"><div class="menuitem-content">选中此点</div></div>
|
||||||
<div id='chooseInRight' class="menuitem"><div class="menuitem-content">在素材区选中此图块</div></div>
|
<div id='chooseInRight' class="menuitem"><div class="menuitem-content">在素材区选中此图块</div></div>
|
||||||
<div id='copyLoc' class="menuitem"><div class="menuitem-content">复制此事件</div></div>
|
<div id='copyLoc' class="menuitem"><div class="menuitem-content">复制此事件</div></div>
|
||||||
<div id='moveLoc' class="menuitem"><div class="menuitem-content">移动此事件</div></div>
|
<div id='pasteLoc' class="menuitem"><div class="menuitem-content">粘贴到此事件</div></div>
|
||||||
<div id='clearEvent' class="menuitem"><div class="menuitem-content">仅清空此点事件</div></div>
|
<div id='clearEvent' class="menuitem"><div class="menuitem-content">仅清空此点事件</div></div>
|
||||||
<div id='clearLoc' class="menuitem"><div class="menuitem-content">清空此点及事件</div></div>
|
<div id='clearLoc' class="menuitem"><div class="menuitem-content">清空此点及事件</div></div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -390,7 +390,7 @@
|
|||||||
<div id='chooseThis' class="menuitem"><div class="menuitem-content">选中此点</div></div>
|
<div id='chooseThis' class="menuitem"><div class="menuitem-content">选中此点</div></div>
|
||||||
<div id='chooseInRight' class="menuitem"><div class="menuitem-content">在素材区选中此图块</div></div>
|
<div id='chooseInRight' class="menuitem"><div class="menuitem-content">在素材区选中此图块</div></div>
|
||||||
<div id='copyLoc' class="menuitem"><div class="menuitem-content">复制此事件</div></div>
|
<div id='copyLoc' class="menuitem"><div class="menuitem-content">复制此事件</div></div>
|
||||||
<div id='moveLoc' class="menuitem"><div class="menuitem-content">移动此事件</div></div>
|
<div id='pasteLoc' class="menuitem"><div class="menuitem-content">粘贴到此事件</div></div>
|
||||||
<div id='clearEvent' class="menuitem"><div class="menuitem-content">仅清空此点事件</div></div>
|
<div id='clearEvent' class="menuitem"><div class="menuitem-content">仅清空此点事件</div></div>
|
||||||
<div id='clearLoc' class="menuitem"><div class="menuitem-content">清空此点及事件</div></div>
|
<div id='clearLoc' class="menuitem"><div class="menuitem-content">清空此点及事件</div></div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -61,7 +61,7 @@
|
|||||||
(已完成!) 难度分歧的图块(颜色,含SL界面)
|
(已完成!) 难度分歧的图块(颜色,含SL界面)
|
||||||
(已完成!) 装备同时加属性和比例
|
(已完成!) 装备同时加属性和比例
|
||||||
(已完成!) removeMap和resumeMap
|
(已完成!) removeMap和resumeMap
|
||||||
右键图块选择复制/粘贴事件
|
(已完成!) 右键图块选择复制/粘贴事件
|
||||||
(已完成!) showImage, drawImage,立绘等加上对称选项
|
(已完成!) showImage, drawImage,立绘等加上对称选项
|
||||||
更多的图块blockly化
|
更多的图块blockly化
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user