nsEventStatus AsyncPanZoomController::HandleInputEvent(const nsInputEvent& aEvent, nsInputEvent* aOutEvent) { float currentZoom; gfx::Point currentScrollOffset, lastScrollOffset; { MonitorAutoLock monitor(mMonitor); currentZoom = mFrameMetrics.mResolution.width; currentScrollOffset = gfx::Point(mFrameMetrics.mViewportScrollOffset.x, mFrameMetrics.mViewportScrollOffset.y); lastScrollOffset = gfx::Point(mLastContentPaintMetrics.mViewportScrollOffset.x, mLastContentPaintMetrics.mViewportScrollOffset.y); } nsEventStatus status; switch (aEvent.eventStructType) { case NS_TOUCH_EVENT: { MultiTouchInput event(static_cast<const nsTouchEvent&>(aEvent)); status = HandleInputEvent(event); break; } case NS_MOUSE_EVENT: { MultiTouchInput event(static_cast<const nsMouseEvent&>(aEvent)); status = HandleInputEvent(event); break; } default: status = nsEventStatus_eIgnore; break; } switch (aEvent.eventStructType) { case NS_TOUCH_EVENT: { nsTouchEvent* touchEvent = static_cast<nsTouchEvent*>(aOutEvent); const nsTArray<nsCOMPtr<nsIDOMTouch> >& touches = touchEvent->touches; for (PRUint32 i = 0; i < touches.Length(); ++i) { nsIDOMTouch* touch = touches[i]; if (touch) { gfx::Point refPoint = WidgetSpaceToCompensatedViewportSpace( gfx::Point(touch->mRefPoint.x, touch->mRefPoint.y), currentZoom); touch->mRefPoint = nsIntPoint(refPoint.x, refPoint.y); } } break; } default: { gfx::Point refPoint = WidgetSpaceToCompensatedViewportSpace( gfx::Point(aOutEvent->refPoint.x, aOutEvent->refPoint.y), currentZoom); aOutEvent->refPoint = nsIntPoint(refPoint.x, refPoint.y); break; } } return status; }
bool EnvironmentModule::HandleEvent(event_category_id_t category_id, event_id_t event_id, Foundation::EventDataInterface* data) { if(category_id == framework_event_category_) { HandleFrameworkEvent(event_id, data); } else if(category_id == resource_event_category_) { HandleResouceEvent(event_id, data); } else if(category_id == network_in_event_category_) { HandleNetworkEvent(event_id, data); } else if (category_id == network_state_event_category_) { if (event_id == ProtocolUtilities::Events::EVENT_SERVER_CONNECTED) { if (GetFramework()->GetDefaultWorldScene().get()) { CreateEnvironment(); CreateTerrain(); CreateWater(); //CreateEnvironment(); CreateSky(); } } if (event_id == ProtocolUtilities::Events::EVENT_SERVER_DISCONNECTED) { if(postprocess_dialog_) postprocess_dialog_->DisableAllEffects(); ReleaseTerrain(); ReleaseWater(); ReleaseEnvironment(); ReleaseSky(); firstTime_ = true; } } else if(category_id == input_event_category_) { HandleInputEvent(event_id, data); } return false; }