Merge pull request #395 from ckcz123/v2.x

V2.x
This commit is contained in:
Zhang Chen 2019-08-20 10:30:54 +08:00 committed by GitHub
commit 12cdb8c47a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 9 deletions

View File

@ -1871,8 +1871,11 @@ core.ui.relocateCanvas(name, x, y)
重新定位一个自定义画布。x和y为画布的左上角坐标。
core.ui.resizeCanvas(name, width, height)
重新设置一个自定义画布的大小。width和height为新设置的宽高。此操作会清空画布。
core.ui.resizeCanvas(name, width, height, styleOnly)
重新设置一个自定义画布的大小。width和height为新设置的宽高。
styleOnly控制是否只修改画布的显示大小而不修改画布的内部大小
如果styleOnly为true则只修改其显示大小即canvas.style.width
否则,则会同时修改画布的显示大小和内部大小并清空画布内容。
core.ui.deleteCanvas(name)

View File

@ -1851,8 +1851,11 @@ core.ui.relocateCanvas(name, x, y)
重新定位一个自定义画布。x和y为画布的左上角坐标。
core.ui.resizeCanvas(name, width, height)
重新设置一个自定义画布的大小。width和height为新设置的宽高。此操作会清空画布。
core.ui.resizeCanvas(name, width, height, styleOnly)
重新设置一个自定义画布的大小。width和height为新设置的宽高。
styleOnly控制是否只修改画布的显示大小而不修改画布的内部大小
如果styleOnly为true则只修改其显示大小即canvas.style.width
否则,则会同时修改画布的显示大小和内部大小并清空画布内容。
core.ui.deleteCanvas(name)

View File

@ -1138,7 +1138,7 @@ events.prototype._action_showTextImage = function (data, x, y, prefix) {
var loc = this.__action_getLoc(data.loc, 0, 0, prefix);
if (core.isReplaying()) data.time = 0;
this.__action_doAsyncFunc(data.async || data.time == 0, core.showImage,
data.code, core.ui.textImage(data.text), loc[0], loc[1], 100, 100, data.opacity, data.time);
data.code, core.ui.textImage(data.text), null, loc, data.opacity, data.time);
}
events.prototype._action_hideImage = function (data, x, y, prefix) {

View File

@ -353,7 +353,7 @@ ui.prototype.calWidth = function (name, text, font) {
////// 字符串自动换行的分割 //////
ui.prototype.splitLines = function (name, text, maxWidth, font) {
var ctx = this.getContextByName(name);
if (!ctx) return;
if (!ctx) return [text];
if (font) core.setFont(name, font);
var contents = [];
@ -2919,15 +2919,15 @@ ui.prototype.relocateCanvas = function (name, x, y) {
}
////// canvas重置 //////
ui.prototype.resizeCanvas = function (name, width, height) {
ui.prototype.resizeCanvas = function (name, width, height, styleOnly) {
var ctx = core.dymCanvas[name];
if (!core.isset(ctx)) return null;
if (core.isset(width)) {
ctx.canvas.width = width;
if (!styleOnly) ctx.canvas.width = width;
ctx.canvas.style.width = width * core.domStyle.scale + 'px';
}
if (core.isset(height)) {
ctx.canvas.height = height;
if (!styleOnly) ctx.canvas.height = height;
ctx.canvas.style.height = height * core.domStyle.scale + 'px';
}
return ctx;