public virtual void dispatchEvent(AsTouchEvent _event) { if(mTarget != null) { _event.dispatch(mBubbleChain); } }
public virtual void dispatchEvent(AsTouchEvent _event) { if (mTarget != null) { _event.dispatch(mBubbleChain); } }
public virtual void advanceTime(float passedTime) { int i = 0; int touchID = 0; AsTouch touch = null; mElapsedTime = mElapsedTime + passedTime; if(mLastTaps.getLength() > 0) { for (i = (int)(mLastTaps.getLength() - 1); i >= 0; --i) { if(mElapsedTime - mLastTaps[i].getTimestamp() > MULTITAP_TIME) { mLastTaps.splice(i, (uint)(1)); } } } while(mQueue.getLength() > 0) { sProcessedTouchIDs.setLength(sHoveringTouchData.setLength(0)); AsVector<AsTouch> __touchs_ = mCurrentTouches; if (__touchs_ != null) { foreach (AsTouch touch in __touchs_) { if(touch.getPhase() == AsTouchPhase.BEGAN || touch.getPhase() == AsTouchPhase.MOVED) { touch.setPhase(AsTouchPhase.STATIONARY); } } } while(mQueue.getLength() > 0 && sProcessedTouchIDs.indexOf(mQueue[mQueue.getLength() - 1][0]) == -1) { AsArray touchArgs = mQueue.pop(); touch = getCurrentTouch(touchID); if(touch != null && touch.getPhase() == AsTouchPhase.HOVER && touch.getTarget() != null) { sHoveringTouchData.push((As_AS_REST)(AsObject.createLiteralObject("touch", touch, "target", touch.getTarget()))); } this.(int)(touchArgs[0]), (String)(touchArgs[1]), (float)(touchArgs[2]), (float)(touchArgs[3]), (float)(touchArgs[4]), (float)(touchArgs[5]), (float)(touchArgs[6]); sProcessedTouchIDs.push(touchID); } AsTouchEvent touchEvent = new AsTouchEvent(AsTouchEvent.TOUCH, mCurrentTouches, mShiftDown, mCtrlDown); AsVector<Object> __touchDatas_ = sHoveringTouchData; if (__touchDatas_ != null) { foreach (Object touchData in __touchDatas_) { if(((AsObject)(((AsObject)(touchData)).getOwnProperty("touch"))).getOwnProperty("target") != ((AsObject)(touchData)).getOwnProperty("target")) { touchEvent.dispatch(getBubbleChain((AsDisplayObject)(((AsObject)(touchData)).getOwnProperty("target")), sBubbleChain)); } } } AsVector<int> __touchIDs_ = sProcessedTouchIDs; if (__touchIDs_ != null) { foreach (int touchID in __touchIDs_) { getCurrentTouch(touchID).dispatchEvent(touchEvent); } } for (i = (int)(mCurrentTouches.getLength() - 1); i >= 0; --i) { if(mCurrentTouches[i].getPhase() == AsTouchPhase.ENDED) { mCurrentTouches.splice(i, (uint)(1)); } } } sBubbleChain.setLength(0); }
private void onInterruption(Object _event) { AsTouch touch = null; String phase = null; AsVector<AsTouch> __touchs_ = mCurrentTouches; if (__touchs_ != null) { foreach (AsTouch touch in __touchs_) { if(touch.getPhase() == AsTouchPhase.BEGAN || touch.getPhase() == AsTouchPhase.MOVED || touch.getPhase() == AsTouchPhase.STATIONARY) { touch.setPhase(AsTouchPhase.ENDED); } } } AsTouchEvent touchEvent = new AsTouchEvent(AsTouchEvent.TOUCH, mCurrentTouches, mShiftDown, mCtrlDown); AsVector<AsTouch> __touchs_ = mCurrentTouches; if (__touchs_ != null) { foreach (AsTouch touch in __touchs_) { touch.dispatchEvent(touchEvent); } } mCurrentTouches.setLength(0); }
private void onTouch(AsTouchEvent _event) { AsMouse.setCursor(mUseHandCursor && mEnabled && _event.interactsWith(this) ? AsMouseCursor.BUTTON : AsMouseCursor.AUTO); AsTouch touch = _event.getTouch(this); if(!mEnabled || touch == null) { return; } if(touch.getPhase() == AsTouchPhase.BEGAN && !mIsDown) { mBackground.setTexture(mDownState); mContents.setScaleX(mContents.setScaleY(mScaleWhenDown)); mContents.setX((1.0f - mScaleWhenDown) / 2.0f * mBackground.getWidth()); mContents.setY((1.0f - mScaleWhenDown) / 2.0f * mBackground.getHeight()); mIsDown = true; } else { if(touch.getPhase() == AsTouchPhase.MOVED && mIsDown) { AsRectangle buttonRect = getBounds(getStage()); if(touch.getGlobalX() < buttonRect.x - MAX_DRAG_DIST || touch.getGlobalY() < buttonRect.y - MAX_DRAG_DIST || touch.getGlobalX() > buttonRect.x + buttonRect.width + MAX_DRAG_DIST || touch.getGlobalY() > buttonRect.y + buttonRect.height + MAX_DRAG_DIST) { resetContents(); } } else { if(touch.getPhase() == AsTouchPhase.ENDED && mIsDown) { resetContents(); dispatchEventWith(AsEvent.TRIGGERED, true); } } } }
private void onTouch(AsTouchEvent _event) { AsMouse.setCursor(_event.interactsWith(this) ? AsMouseCursor.BUTTON : AsMouseCursor.AUTO); }