fix: android 机型上问题

This commit is contained in:
dongqing 2019-12-04 19:58:59 +08:00
parent 36ce87fe20
commit 045bc344b8

View File

@ -84,7 +84,9 @@ Component({
observer: function (needClear) { observer: function (needClear) {
if (needClear && !this.needClear) { if (needClear && !this.needClear) {
if (this.frontContext) { if (this.frontContext) {
this.frontContext.draw() setTimeout(() => {
this.frontContext.draw();
}, 100);
this.touchedView = {}; this.touchedView = {};
this.prevFindedIndex = this.findedIndex this.prevFindedIndex = this.findedIndex
this.findedIndex = -1; this.findedIndex = -1;
@ -296,8 +298,8 @@ Component({
height: this.currentPalette.height, height: this.currentPalette.height,
views: this.isEmpty(doView) ? [] : [doView] views: this.isEmpty(doView) ? [] : [doView]
} }
const pen = new Pen(this.globalContext, draw); const pen = new Pen(this.globalContext, draw);
if (isMoving && doView.type === 'text') { if (isMoving && doView.type === 'text') {
pen.paint((callbackInfo) => { pen.paint((callbackInfo) => {
callback && callback(callbackInfo); callback && callback(callbackInfo);
@ -306,6 +308,9 @@ Component({
}); });
}, true, this.movingCache); }, true, this.movingCache);
} else { } else {
// 某些机型(华为 P20只绘制一遍会偶然性没法展示目前采用再绘一遍的方法次方法加上后没法针对半透明场景会导致叠加增强
// 后续找到原因
pen.paint()
pen.paint((callbackInfo) => { pen.paint((callbackInfo) => {
callback && callback(callbackInfo); callback && callback(callbackInfo);
this.triggerEvent('viewUpdate', { this.triggerEvent('viewUpdate', {
@ -313,11 +318,13 @@ Component({
}); });
}) })
} }
const { const {
rect, rect,
css, css,
type type
} = doView } = doView
this.block = { this.block = {
width: this.currentPalette.width, width: this.currentPalette.width,
height: this.currentPalette.height, height: this.currentPalette.height,
@ -419,13 +426,7 @@ Component({
} }
if (this.findedIndex < 0 || (this.touchedView && !this.touchedView.id)) { if (this.findedIndex < 0 || (this.touchedView && !this.touchedView.id)) {
// 证明点击了背景 或无法移动的view // 证明点击了背景 或无法移动的view
const block = { this.frontContext.draw();
width: this.currentPalette.width,
height: this.currentPalette.height,
views: []
}
const topBlock = new Pen(this.frontContext, block)
topBlock.paint();
if (isDelete) { if (isDelete) {
this.triggerEvent('touchEnd', { this.triggerEvent('touchEnd', {
view: this.currentPalette.views[deleteIndex], view: this.currentPalette.views[deleteIndex],
@ -439,7 +440,7 @@ Component({
this.findedIndex = -1 this.findedIndex = -1
this.prevFindedIndex = -1 this.prevFindedIndex = -1
} else if (this.touchedView && this.touchedView.id) { } else if (this.touchedView && this.touchedView.id) {
this.sliceLayers() this.sliceLayers();
} }
}, },
@ -611,7 +612,6 @@ Component({
initDancePalette() { initDancePalette() {
this.initScreenK(); this.initScreenK();
this.downloadImages(this.properties.dancePalette).then((palette) => { this.downloadImages(this.properties.dancePalette).then((palette) => {
this.currentPalette = palette this.currentPalette = palette
const { const {
@ -633,21 +633,9 @@ Component({
new Pen(this.bottomContext, palette).paint(() => { new Pen(this.bottomContext, palette).paint(() => {
this.triggerEvent('didShow'); this.triggerEvent('didShow');
}); });
new Pen(this.globalContext, { this.globalContext.draw();
width, this.frontContext.draw();
height, this.topContext.draw();
views: []
}).paint();
new Pen(this.frontContext, {
width,
height,
views: []
}).paint();
new Pen(this.topContext, {
width,
height,
views: []
}).paint();
}); });
this.touchedView = {}; this.touchedView = {};
}, },
@ -838,4 +826,4 @@ function setStringPrototype(screenK, scale) {
} }
return res; return res;
}; };
} }