|
423行的代码里
isOnPicturePos(x = TouchInput.x, y = TouchInput.y) {
const pic = this._picture;
if (!pic.bitmap || !pic.bitmap.isReady() || pic.scale.x === 0 || pic.scale.y === 0) {
return false;
}
if (this.isTouchPosInFrameWindow()) {
return true;
}
const dx = this.getTouchScreenX(x) - pic.x;
const dy = this.getTouchScreenY(y) - pic.y;
const sin = Math.sin(-pic.rotation);
const cos = Math.cos(-pic.rotation);
const bx = Math.floor(dx * cos + dy * -sin) / pic.scale.x + pic.anchor.x * pic.width;
const by = Math.floor(dx * sin + dy * cos) / pic.scale.y + pic.anchor.y * pic.height;
return pic.bitmap.getAlphaPixel(bx, by) !== 0;
}
它贴心帮你判定了,点击处不为透明像素才算成功点击 |
|