selectPoint fix bug
This commit is contained in:
parent
b15782228a
commit
4391e8cd7d
@ -734,11 +734,11 @@ function omitedcheckUpdateFunction(event) {
|
|||||||
|
|
||||||
// ------ select point ------
|
// ------ select point ------
|
||||||
|
|
||||||
// id: [x, y, floorId]
|
// id: [x, y, floorId, forceFloor]
|
||||||
var selectPointBlocks = {
|
var selectPointBlocks = {
|
||||||
"changeFloor_m": ["Number_0", "Number_1", "IdString_0"],
|
"changeFloor_m": ["Number_0", "Number_1", "IdString_0", true],
|
||||||
"jumpHero_s": ["PosString_0", "PosString_1"],
|
"jumpHero_s": ["PosString_0", "PosString_1"],
|
||||||
"changeFloor_s": ["PosString_0", "PosString_1", "IdString_0"],
|
"changeFloor_s": ["PosString_0", "PosString_1", "IdString_0", true],
|
||||||
"changePos_0_s": ["PosString_0", "PosString_1"],
|
"changePos_0_s": ["PosString_0", "PosString_1"],
|
||||||
"battle_1_s": ["PosString_0", "PosString_1"],
|
"battle_1_s": ["PosString_0", "PosString_1"],
|
||||||
"openDoor_s": ["PosString_0", "PosString_1", "IdString_0"],
|
"openDoor_s": ["PosString_0", "PosString_1", "IdString_0"],
|
||||||
@ -758,26 +758,23 @@ function omitedcheckUpdateFunction(event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
editor_blockly.selectPoint = function () {
|
editor_blockly.selectPoint = function () {
|
||||||
var block = Blockly.selected, x_area = null, y_area = null, floor_area = null;
|
var block = Blockly.selected, arr = null;
|
||||||
var floorId = editor.currentFloorId, pos = editor.pos, x = pos.x, y = pos.y;
|
var floorId = editor.currentFloorId, pos = editor.pos, x = pos.x, y = pos.y;
|
||||||
if (block != null && block.type in selectPointBlocks) {
|
if (block != null && block.type in selectPointBlocks) {
|
||||||
var arr = selectPointBlocks[block.type];
|
arr = selectPointBlocks[block.type];
|
||||||
x_area = arr[0];
|
var xv = parseInt(block.getFieldValue(arr[0])), yv = parseInt(block.getFieldValue(arr[1]));
|
||||||
y_area = arr[1];
|
|
||||||
floor_area = arr[2];
|
|
||||||
var xv = parseInt(block.getFieldValue(x_area)), yv = parseInt(block.getFieldValue(y_area));
|
|
||||||
if (!isNaN(xv)) x = xv;
|
if (!isNaN(xv)) x = xv;
|
||||||
if (!isNaN(yv)) y = yv;
|
if (!isNaN(yv)) y = yv;
|
||||||
if (floor_area != null) floorId = block.getFieldValue(floor_area) || floorId;
|
if (arr[2] != null) floorId = block.getFieldValue(arr[2]) || floorId;
|
||||||
}
|
}
|
||||||
uievent.selectPoint(floorId, x, y, floor_area == null, function (fv, xv, yv) {
|
uievent.selectPoint(floorId, x, y, arr && arr[2] == null, function (fv, xv, yv) {
|
||||||
if (x_area == null || y_area == null) return;
|
if (!arr) return;
|
||||||
if (floor_area != null) {
|
if (arr[2] != null) {
|
||||||
if (fv != editor.currentFloorId) block.setFieldValue(fv, floor_area);
|
if (fv != editor.currentFloorId) block.setFieldValue(fv, arr[2]);
|
||||||
else block.setFieldValue("", floor_area);
|
else block.setFieldValue(arr[3] ? fv : "", arr[2]);
|
||||||
}
|
}
|
||||||
block.setFieldValue(xv, x_area);
|
block.setFieldValue(xv+"", arr[0]);
|
||||||
block.setFieldValue(yv, y_area);
|
block.setFieldValue(yv+"", arr[1]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -483,6 +483,7 @@ uievent.updateSelectPoint = function (redraw) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
uievent.setPoint = function (floorId, x, y) {
|
uievent.setPoint = function (floorId, x, y) {
|
||||||
|
if (core.floorIds.indexOf(floorId) == -1) floorId = editor.currentFloorId;
|
||||||
uievent.values.floorId = floorId;
|
uievent.values.floorId = floorId;
|
||||||
uievent.elements.selectFloor.value = floorId;
|
uievent.elements.selectFloor.value = floorId;
|
||||||
uievent.values.x = x != null ? x : ( uievent.values.x || 0);
|
uievent.values.x = x != null ? x : ( uievent.values.x || 0);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user