From 6baedf5ba15a3157b27061d6e47cbdf49769efcd Mon Sep 17 00:00:00 2001
From: 0JARVIS0 <709406687@qq.com>
Date: Mon, 2 Dec 2019 09:23:20 +0800
Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=9C=9F=E6=9C=BA?=
=?UTF-8?q?=E4=B8=8Adisabledaction=E6=97=A0=E6=95=88=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
painter.js | 19 ++++++++++++++-----
painter.wxml | 2 +-
2 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/painter.js b/painter.js
index 740f2e1..7763934 100644
--- a/painter.js
+++ b/painter.js
@@ -15,6 +15,7 @@ Component({
paintCount: 0,
currentPalette: {},
movingCache: {},
+ isDisabled: false,
needClear: false,
/**
* 组件的属性列表
@@ -75,10 +76,7 @@ Component({
disableAction: {
type: Boolean,
observer: function (isDisabled) {
- let style = isDisabled ? 'visibility: hidden' : ''
- this.setData({
- frontStyle: style
- })
+ this.isDisabled = isDisabled
}
},
clearActionBox: {
@@ -101,7 +99,6 @@ Component({
picURL: '',
showCanvas: true,
painterStyle: '',
- frontStyle: '',
},
methods: {
@@ -473,6 +470,9 @@ Component({
isScale: false,
startTimeStamp: 0,
onTouchStart(event) {
+ if (this.isDisabled) {
+ return
+ }
const {
x,
y
@@ -496,6 +496,9 @@ Component({
},
onTouchEnd(e) {
+ if (this.isDisabled) {
+ return
+ }
const current = new Date().getTime()
if ((current - this.startTimeStamp) <= 500 && !this.hasMove) {
!this.isScale && this.onClick(e)
@@ -508,11 +511,17 @@ Component({
},
onTouchCancel(e) {
+ if (this.isDisabled) {
+ return
+ }
this.onTouchEnd(e)
},
hasMove: false,
onTouchMove(event) {
+ if (this.isDisabled) {
+ return
+ }
this.hasMove = true
if (!this.touchedView || (this.touchedView && !this.touchedView.id)) {
return
diff --git a/painter.wxml b/painter.wxml
index 183e2ff..38673ae 100644
--- a/painter.wxml
+++ b/painter.wxml
@@ -5,7 +5,7 @@