Commit f49611da authored by wjf's avatar wjf

l

parent 2bfdba48
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
......@@ -37,12 +37,12 @@ export class TextField extends Sprite {
var canvas = createCanvas()
// canvas.width = 3;
// canvas.height = 3;
if (osType == "ios") {
// if (osType == "ios") {
canvas.width = canvas.height = 3;
} else {//现在只能用canvas2d渲染,所以不能用imageData了,等修复了安卓canvas尺寸问题再改
canvas.width = 300;
canvas.height = 150;
}
// } else {//现在只能用canvas2d渲染,所以不能用imageData了,等修复了安卓canvas尺寸问题再改
// canvas.width = 300;
// canvas.height = 150;
// }
this.texture = Texture.fromCanvas(canvas, "textCanvas");
this.canvas = canvas;
this.context = canvas.getContext("2d");
......@@ -491,13 +491,13 @@ export class TextField extends Sprite {
s.dirty = false;
//如果没有文本
if (!s._text) {
if (osType == "ios") {
// if (osType == "ios") {
s.canvas.width = 0;
s.canvas.height = 0;
} else {//暂时不能用sourceData形式,所以和上面效果一样
s.texture.baseTexture.source.width = 0;
s.texture.baseTexture.source.height = 0;
}
// } else {//暂时不能用sourceData形式,所以和上面效果一样
// s.texture.baseTexture.source.width = 0;
// s.texture.baseTexture.source.height = 0;
// }
s._localBoundsSelf.clear();
s.anchorTexture = { x: 0, y: 0 };
s.texture.update()
......@@ -582,6 +582,7 @@ export class TextField extends Sprite {
let canHeight = maxH + padding * 2;
can.width = canWidth
can.height = canHeight
ctx.setTransform(1, 0, 0, 1, 0, 0);//在不能修改尺寸的时候,否则尺寸改变,上下文会初始化
ctx.clearRect(0, 0, can.width, can.height);//安卓貌似无效,文案重叠了再处理,或者等修复了尺寸问题就好了
if (s.border) {
ctx.beginPath();
......@@ -606,7 +607,7 @@ export class TextField extends Sprite {
for (let i = 0; i < realLines.length; i++) {
let ox = 0;
//@ts-ignore 现在貌似小程序的textAlign有点问题,如果修复了再说
if (my) ox = - tx;//移回去
// if (my) ox = - tx;//移回去,已经修复,注释掉吧
if (s.stroke) {
ctx.strokeStyle = s.strokeColor;
ctx.lineWidth = s.stroke * 2;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment