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