Merge commit '54e854d1bfe367173a11ef2956bafa675ee7fa12' into dev

This commit is contained in:
CPPAlien 2019-12-09 11:44:29 +08:00
commit abc9464ec2
2 changed files with 7 additions and 4 deletions

View File

@ -204,7 +204,7 @@ export default class Painter {
for (let i = 0; i < textArray.length; ++i) { for (let i = 0; i < textArray.length; ++i) {
const textLength = this.ctx.measureText(textArray[i]).width; const textLength = this.ctx.measureText(textArray[i]).width;
let partWidth = view.css.width ? view.css.width.toPx(false, this.style.width) - paddings[1] - paddings[3] : textLength; let partWidth = view.css.width ? view.css.width.toPx(false, this.style.width) - paddings[1] - paddings[3] : textLength;
partWidth = partWidth > fontSize ? partWidth - partWidth % fontSize + fontSize : fontSize // partWidth = partWidth > fontSize ? partWidth - partWidth % fontSize + fontSize : fontSize
const calLines = Math.ceil(textLength / partWidth); const calLines = Math.ceil(textLength / partWidth);
// 取最长的作为 width // 取最长的作为 width
width = partWidth > width ? partWidth : width; width = partWidth > width ? partWidth : width;

View File

@ -66,7 +66,7 @@ Component({
action: { action: {
type: Object, type: Object,
observer: function (newVal, oldVal) { observer: function (newVal, oldVal) {
if (newVal) { if (newVal && !this.isEmpty(newVal)) {
this.doAction(newVal, (callbackInfo) => { this.doAction(newVal, (callbackInfo) => {
this.movingCache = callbackInfo this.movingCache = callbackInfo
}, false, true) }, false, true)
@ -268,7 +268,7 @@ Component({
} }
if (newVal && newVal.url && doView.url && newVal.url !== doView.url) { if (newVal && newVal.url && doView.url && newVal.url !== doView.url) {
downloader.download(newVal.url, this.properties.LRU).then((path) => { downloader.download(newVal.url, this.properties.LRU).then((path) => {
if (newVal.url.startsWidth('https')) { if (newVal.url.startsWith('https')) {
doView.originUrl = newVal.url doView.originUrl = newVal.url
} }
doView.url = path; doView.url = path;
@ -283,8 +283,9 @@ Component({
this.reDraw(doView, callback, isMoving) this.reDraw(doView, callback, isMoving)
} }
}) })
}).catch(() => { }).catch((error) => {
// 未下载成功,直接绘制 // 未下载成功,直接绘制
console.error(error)
this.reDraw(doView, callback, isMoving) this.reDraw(doView, callback, isMoving)
}) })
} else { } else {
@ -614,6 +615,7 @@ Component({
}, },
initDancePalette() { initDancePalette() {
this.isDisabled = true;
this.initScreenK(); this.initScreenK();
this.downloadImages(this.properties.dancePalette).then((palette) => { this.downloadImages(this.properties.dancePalette).then((palette) => {
this.currentPalette = palette this.currentPalette = palette
@ -634,6 +636,7 @@ Component({
this.topContext || (this.topContext = wx.createCanvasContext('top', this)); this.topContext || (this.topContext = wx.createCanvasContext('top', this));
this.globalContext || (this.globalContext = wx.createCanvasContext('k-canvas', this)); this.globalContext || (this.globalContext = wx.createCanvasContext('k-canvas', this));
new Pen(this.bottomContext, palette).paint(() => { new Pen(this.bottomContext, palette).paint(() => {
this.isDisabled = false;
this.triggerEvent('didShow'); this.triggerEvent('didShow');
}); });
this.globalContext.draw(); this.globalContext.draw();