Skip to content

Commit

Permalink
继续优化
Browse files Browse the repository at this point in the history
  • Loading branch information
anlun214 committed Apr 11, 2017
1 parent 86a1ea0 commit c4e0bf2
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
4 changes: 2 additions & 2 deletions annie/display/DisplayObject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -385,11 +385,11 @@ namespace annie {
* @param {boolean} isMouseEvent 是否是鼠标事件调用此方法,用户一般无须理会,除非你要模拟鼠标点击可以
* @returns {annie.DisplayObject}
*/
public hitTestPoint(globalPoint: Point, isMouseEvent: boolean = false): DisplayObject {
public hitTestPoint(globalPoint: Point,isMouseEvent: boolean = false): DisplayObject {
let s = this;
if (!s.visible)return null;
if (isMouseEvent && !s.mouseEnable)return null;
if (s.getBounds().isPointIn(s.globalToLocal(globalPoint, isMouseEvent?DisplayObject._bp:null))) {
if (s.getBounds().isPointIn(s.globalToLocal(globalPoint, DisplayObject._bp))){
return s;
}
return null;
Expand Down
2 changes: 1 addition & 1 deletion build/annieCore.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2868,7 +2868,7 @@ declare namespace annie {
*/
iosTouchendPreventDefault: boolean;
/**
* 是否禁止引擎所在的canvas的鼠标或触摸事件的默认形为,默认是静止的
* 是否禁止引擎所在的canvas的鼠标事件或触摸事件的默认形为,默认为true是禁止的
* @property isPreventDefaultEvent
* @since 1.0.9
* @default true
Expand Down
16 changes: 9 additions & 7 deletions build/annieCore.js
Original file line number Diff line number Diff line change
Expand Up @@ -1759,7 +1759,7 @@ var annie;
return null;
if (isMouseEvent && !s.mouseEnable)
return null;
if (s.getBounds().isPointIn(s.globalToLocal(globalPoint, isMouseEvent ? DisplayObject._bp : null))) {
if (s.getBounds().isPointIn(s.globalToLocal(globalPoint, DisplayObject._bp))) {
return s;
}
return null;
Expand Down Expand Up @@ -5752,7 +5752,7 @@ var annie;
*/
this.iosTouchendPreventDefault = true;
/**
* 是否禁止引擎所在的canvas的鼠标或触摸事件的默认形为,默认是静止的
* 是否禁止引擎所在的canvas的鼠标事件或触摸事件的默认形为,默认为true是禁止的
* @property isPreventDefaultEvent
* @since 1.0.9
* @default true
Expand Down Expand Up @@ -6190,11 +6190,13 @@ var annie;
}
}
}
if ((e.type == "touchend") && (annie.osType == "ios") && (s.iosTouchendPreventDefault)) {
e.preventDefault();
}
if ((e.type == "touchmove") || (e.type == "touchstart" && annie.osType == "android")) {
e.preventDefault();
if (s.isPreventDefaultEvent) {
if ((e.type == "touchend") && (annie.osType == "ios") && (s.iosTouchendPreventDefault)) {
e.preventDefault();
}
if ((e.type == "touchmove") || (e.type == "touchstart" && annie.osType == "android")) {
e.preventDefault();
}
}
if (s._uae) {
s.update();
Expand Down
4 changes: 2 additions & 2 deletions build/annieCore.min.js

Large diffs are not rendered by default.

0 comments on commit c4e0bf2

Please sign in to comment.