Commit 29e1963b authored by 李维's avatar 李维

对返回坐标进行保护

小于0返回0
大于1返回1
其他不变
parent e9a2e097
...@@ -608,17 +608,31 @@ cc.Class({ ...@@ -608,17 +608,31 @@ cc.Class({
} }
this._lastFingerPosition = { this._lastFingerPosition = {
pos:{ pos:{
x: p.x, x: this.boundedPostion(p.x),
y: p.y y: this.boundedPostion(p.y)
}, },
dirty: true dirty: true
} }
this.debugPointer(p.x, p.y) this.debugPointer(this.boundedPostion(p.x), this.boundedPostion(p.y))
} }
} }
this.isDebug = false; this.isDebug = false;
}, },
// 限定坐标值
boundedPostion(value) {
if(value<0) {
return 0
}
if(value>1) {
return 1
}
return value
},
checkInRegion(r) { checkInRegion(r) {
if (!this._lastFingerPosition && !this._lastFingerPosition.pos) { if (!this._lastFingerPosition && !this._lastFingerPosition.pos) {
return null; return null;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment