Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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
18 changes: 10 additions & 8 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 @@ -2059,8 +2059,8 @@ TouchEvent::TouchEvent( Real x, Real y, Real xStartScreen, Real yStartScreen, Ph
fXStartContent( xStartScreen ),
fYStartContent( yStartScreen ),
fPressure( pressure ),
fDeltaX( x - xStartScreen ),
fDeltaY( y - yStartScreen )
fDeltaX( x ),
fDeltaY( y )
{
}

Expand All @@ -2085,14 +2085,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 +2117,7 @@ void
TouchEvent::Dispatch( lua_State *L, Runtime& runtime ) const
{
ScreenToContent( runtime.GetDisplay(), fXStartScreen, fYStartScreen, fXStartContent, fYStartContent );

Super::Dispatch( L, runtime );
}

Expand Down
4 changes: 2 additions & 2 deletions librtt/Rtt_Event.h
Original file line number Diff line number Diff line change
Expand Up @@ -945,8 +945,8 @@ class TouchEvent : public HitEvent
mutable Real fXStartContent;
mutable Real fYStartContent;
Real fPressure;
Real fDeltaX;
Real fDeltaY;
mutable Real fDeltaX;
mutable Real fDeltaY;
};

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