Dynamic canvas
This commit is contained in:
parent
65f9fcb612
commit
340cbe73a0
22
libs/ui.js
22
libs/ui.js
@ -962,7 +962,6 @@ ui.prototype.drawConfirmBox = function (text, yesCallback, noCallback) {
|
|||||||
if (core.status.event.selection<0) core.status.event.selection=0;
|
if (core.status.event.selection<0) core.status.event.selection=0;
|
||||||
|
|
||||||
core.clearLastEvent();
|
core.clearLastEvent();
|
||||||
core.setFillStyle('ui', core.material.groundPattern);
|
|
||||||
|
|
||||||
var background = core.status.textAttribute.background;
|
var background = core.status.textAttribute.background;
|
||||||
var isWindowSkin = false;
|
var isWindowSkin = false;
|
||||||
@ -1013,7 +1012,7 @@ ui.prototype.drawConfirmBox = function (text, yesCallback, noCallback) {
|
|||||||
var strokeLeft = 208 + (76*core.status.event.selection-38) - parseInt(len/2) - 5;
|
var strokeLeft = 208 + (76*core.status.event.selection-38) - parseInt(len/2) - 5;
|
||||||
|
|
||||||
if (isWindowSkin)
|
if (isWindowSkin)
|
||||||
this.drawWindowSelector(background, 'ui', strokeLeft, bottom-35-20, len+10, 28);
|
this.drawWindowSelector(background, strokeLeft, bottom-35-20, len+10, 28);
|
||||||
else
|
else
|
||||||
core.strokeRect('ui', strokeLeft, bottom-35-20, len+10, 28, "#FFD700", 2);
|
core.strokeRect('ui', strokeLeft, bottom-35-20, len+10, 28, "#FFD700", 2);
|
||||||
|
|
||||||
@ -2764,7 +2763,7 @@ ui.prototype.drawHelp = function () {
|
|||||||
|
|
||||||
////// canvas创建 //////
|
////// canvas创建 //////
|
||||||
ui.prototype.createCanvas = function (name, x, y, width, height, z) {
|
ui.prototype.createCanvas = function (name, x, y, width, height, z) {
|
||||||
var newCanvas = document.createElement("CANVAS");
|
var newCanvas = document.createElement("canvas");
|
||||||
newCanvas.id = name;
|
newCanvas.id = name;
|
||||||
newCanvas.style.display = 'block';
|
newCanvas.style.display = 'block';
|
||||||
newCanvas.width = width;
|
newCanvas.width = width;
|
||||||
@ -2788,17 +2787,17 @@ ui.prototype.createCanvas = function (name, x, y, width, height, z) {
|
|||||||
|
|
||||||
////// canvas查找 //////
|
////// canvas查找 //////
|
||||||
ui.prototype.findCanvas = function (name) {
|
ui.prototype.findCanvas = function (name) {
|
||||||
var index = 0;
|
for (var index = 0; index < core.dymCanvas._list.length; index++) {
|
||||||
while (index < core.dymCanvas._list.length && core.dymCanvas._list[index].id != name) index++;
|
if (core.dymCanvas._list[index].id == name)
|
||||||
if (index == core.dymCanvas._list.length) {
|
return index;
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
return index;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
////// canvas重定位 //////
|
////// canvas重定位 //////
|
||||||
ui.prototype.relocateCanvas = function (name, x, y) {
|
ui.prototype.relocateCanvas = function (name, x, y) {
|
||||||
var index = core.findCanvas(name);
|
var index = core.findCanvas(name);
|
||||||
|
if (index < 0) return;
|
||||||
if (core.isset(x)) {
|
if (core.isset(x)) {
|
||||||
core.dymCanvas[name].canvas.style.left = x * core.domStyle.scale + 'px';
|
core.dymCanvas[name].canvas.style.left = x * core.domStyle.scale + 'px';
|
||||||
core.dymCanvas._list[index].style.left = x;
|
core.dymCanvas._list[index].style.left = x;
|
||||||
@ -2824,11 +2823,8 @@ ui.prototype.resizeCanvas = function (name, width, height) {
|
|||||||
////// canvas删除 //////
|
////// canvas删除 //////
|
||||||
ui.prototype.deleteCanvas = function (name) {
|
ui.prototype.deleteCanvas = function (name) {
|
||||||
var index = core.findCanvas(name);
|
var index = core.findCanvas(name);
|
||||||
if (index == -1) {
|
if (index == -1) return;
|
||||||
console.error("未找到"+name);
|
core.dom.dymCanvas.removeChild(core.dom.dymCanvas.childNodes[index]);
|
||||||
}
|
|
||||||
var obj = core.dom.dymCanvas.removeChild(core.dom.dymCanvas.childNodes[index]);
|
|
||||||
obj = null;
|
|
||||||
core.dymCanvas[name] = null;
|
core.dymCanvas[name] = null;
|
||||||
core.dymCanvas._list.splice(index,1);
|
core.dymCanvas._list.splice(index,1);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user