Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 11 additions & 14 deletions librtt/Rtt_Event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1802,7 +1802,6 @@ HitEvent::DispatchFocused( lua_State *L, Runtime& runtime, StageObject& stage, D
Rtt_ASSERT( focus );

bool handled = false;

ScreenToContent( runtime.GetDisplay(), fXScreen, fYScreen, fXContent, fYContent );

// If we have focus, then dispatch only to that object or its ancestors
Expand Down Expand Up @@ -1865,9 +1864,10 @@ HitEvent::Dispatch( lua_State *L, Runtime& runtime ) const
StageObject& stage = * display.GetStage();
DisplayObject* focus = stage.GetFocus();
bool handled = false;

if ( focus )
{
handled = DispatchFocused( L, runtime, stage, focus );
handled = DispatchFocused( L, runtime, stage, focus);
}
else
{
Expand Down Expand Up @@ -2044,9 +2044,7 @@ TouchEvent::TouchEvent()
fYStartScreen( Rtt_REAL_0 ),
fXStartContent( Rtt_REAL_0 ),
fYStartContent( Rtt_REAL_0 ),
fPressure( kPressureInvalid ),
fDeltaX( Rtt_REAL_0 ),
fDeltaY( Rtt_REAL_0 )
fPressure( kPressureInvalid )
{
}

Expand All @@ -2058,9 +2056,7 @@ TouchEvent::TouchEvent( Real x, Real y, Real xStartScreen, Real yStartScreen, Ph
fYStartScreen( yStartScreen ),
fXStartContent( xStartScreen ),
fYStartContent( yStartScreen ),
fPressure( pressure ),
fDeltaX( x - xStartScreen ),
fDeltaY( y - yStartScreen )
fPressure( pressure )
{
}

Expand All @@ -2085,14 +2081,16 @@ TouchEvent::Push( lua_State *L ) const

lua_pushstring( L, StringForPhase( (Phase)fPhase ) );
lua_setfield( L, -2, kPhaseKey );

lua_pushnumber( L, Rtt_RealToFloat( fXStartContent ) );
lua_setfield( L, -2, kXStartKey );
lua_pushnumber( L, Rtt_RealToFloat( fYStartContent ) );
lua_setfield( L, -2, kYStartKey );
lua_pushinteger( L, Rtt_RealToInt( fDeltaX) );


lua_pushnumber( L, X()-Rtt_RealToFloat( fXStartContent ) );
lua_setfield( L, -2, kXDeltaKey );
lua_pushinteger( L, Rtt_RealToInt( fDeltaY ));
lua_pushnumber( L, Y()-Rtt_RealToFloat( fYStartContent ));
lua_setfield( L, -2, kYDeltaKey );

if ( fPressure >= kPressureThreshold )
Expand All @@ -2115,7 +2113,7 @@ void
TouchEvent::Dispatch( lua_State *L, Runtime& runtime ) const
{
ScreenToContent( runtime.GetDisplay(), fXStartScreen, fYStartScreen, fXStartContent, fYStartContent );

Super::Dispatch( L, runtime );
}

Expand Down Expand Up @@ -2173,8 +2171,7 @@ MultitouchEvent::Dispatch( lua_State *L, Runtime& runtime ) const
if ( object )
{
// Dispatch focused per-object touch events
e.DispatchFocused( L, runtime, stage, object );

e.DispatchFocused( L, runtime, stage, object);
// Cleanup: remove per-object focus at the end of the touch (e.g. phase is "ended" or "cancelled")
if ( shouldCleanup )
{
Expand Down
5 changes: 1 addition & 4 deletions librtt/Rtt_Event.h
Original file line number Diff line number Diff line change
Expand Up @@ -934,8 +934,6 @@ class TouchEvent : public HitEvent
public:
bool IsProperty( U16 mask ) const { return (fProperties & mask) != 0; }
void SetProperty( U16 mask, bool value );
Rtt_FORCE_INLINE Real DeltaX() const { return fDeltaX; };
Rtt_FORCE_INLINE Real DeltaY() const { return fDeltaY; };

private:
U16 fPhase;
Expand All @@ -945,8 +943,7 @@ class TouchEvent : public HitEvent
mutable Real fXStartContent;
mutable Real fYStartContent;
Real fPressure;
Real fDeltaX;
Real fDeltaY;

};

// ----------------------------------------------------------------------------
Expand Down