fix
This commit is contained in:
parent
fcac5386e0
commit
34c16e8a36
@ -34,8 +34,8 @@ export default class Painter {
|
|||||||
|
|
||||||
this._doClip(this.data.borderRadius, width, height);
|
this._doClip(this.data.borderRadius, width, height);
|
||||||
if (!bg) {
|
if (!bg) {
|
||||||
// 如果未设置背景,则默认使用白色
|
// 如果未设置背景,则默认使用透明色
|
||||||
this.ctx.fillStyle = '#fff';
|
this.ctx.fillStyle = 'transparent';
|
||||||
this.ctx.fillRect(-(width / 2), -(height / 2), width, height);
|
this.ctx.fillRect(-(width / 2), -(height / 2), width, height);
|
||||||
} else if (bg.startsWith('#') || bg.startsWith('rgba') || bg.toLowerCase() === 'transparent') {
|
} else if (bg.startsWith('#') || bg.startsWith('rgba') || bg.toLowerCase() === 'transparent') {
|
||||||
// 背景填充颜色
|
// 背景填充颜色
|
||||||
|
|||||||
@ -130,17 +130,22 @@ Component({
|
|||||||
background: this.currentPalette.background,
|
background: this.currentPalette.background,
|
||||||
views: bottomLayers
|
views: bottomLayers
|
||||||
}
|
}
|
||||||
new Pen(wx.createCanvasContext('bottom', this), bottomDraw).paint();
|
|
||||||
|
|
||||||
const topDraw = {
|
const topDraw = {
|
||||||
width: this.currentPalette.width,
|
width: this.currentPalette.width,
|
||||||
height: this.currentPalette.height,
|
height: this.currentPalette.height,
|
||||||
views: topLayers
|
views: topLayers
|
||||||
}
|
}
|
||||||
|
if (this.prevFindedIndex < findedIndex) {
|
||||||
|
new Pen(wx.createCanvasContext('bottom', this), bottomDraw).paint();
|
||||||
new Pen(wx.createCanvasContext('top', this), topDraw).paint();
|
new Pen(wx.createCanvasContext('top', this), topDraw).paint();
|
||||||
|
} else {
|
||||||
|
new Pen(wx.createCanvasContext('top', this), topDraw).paint();
|
||||||
|
new Pen(wx.createCanvasContext('bottom', this), bottomDraw).paint();
|
||||||
|
}
|
||||||
|
|
||||||
this.doAction()
|
this.doAction()
|
||||||
}
|
}
|
||||||
|
this.prevFindedIndex = findedIndex
|
||||||
},
|
},
|
||||||
|
|
||||||
onTouchEnd() {
|
onTouchEnd() {
|
||||||
|
|||||||
12
painter.wxml
12
painter.wxml
@ -1,6 +1,12 @@
|
|||||||
<canvas canvas-id="k-canvas"
|
<view style='position: relative;{{painterStyle}}{{customStyle}}'>
|
||||||
style="{{painterStyle}}{{customStyle}}"
|
<canvas canvas-id="bottom" style="{{painterStyle}};position: absolute;" />
|
||||||
|
<canvas canvas-id="k-canvas" style="{{painterStyle}};position: absolute;" />
|
||||||
|
<canvas
|
||||||
|
canvas-id="top"
|
||||||
|
style="{{painterStyle}};position: absolute;"
|
||||||
bindtouchstart="onTouchStart"
|
bindtouchstart="onTouchStart"
|
||||||
bindtouchmove="onTouchMove"
|
bindtouchmove="onTouchMove"
|
||||||
bindtouchend="onTouchEnd"
|
bindtouchend="onTouchEnd"
|
||||||
bindtouchcancel="onTouchCancel"/>
|
bindtouchcancel="onTouchCancel"
|
||||||
|
disable-scroll="{{true}}" />
|
||||||
|
</view>
|
||||||
Loading…
Reference in New Issue
Block a user