예제 #1
0
void ScatterCtrl::DoMouseAction(bool down, Point pt, ScatterAction action, int value)
{
    if (!down) {
        Scrolling(false, pt);
        LabelPopUp(false, pt);
        ZoomWindow(false, pt);
    }
    switch (action) {
    case SCROLL:
        Scrolling(down, pt);
        break;
    case ZOOM_H_ENL:
    case ZOOM_H_RED:
        MouseZoom(value, true, false);
        break;
    case ZOOM_V_ENL:
    case ZOOM_V_RED:
        MouseZoom(value, false, true);
        break;
    case SHOW_COORDINATES:
        LabelPopUp(down, pt);
        break;
    case ZOOM_WINDOW:
        ZoomWindow(down, pt);
        break;
    case CONTEXT_MENU:
        if(showContextMenu)
            MenuBar::Execute(THISBACK(ContextMenu));
        break;
    case NO_ACTION:
        ;
    }
}
예제 #2
0
void ScatterCtrl::DoKeyAction(ScatterAction action)
{
    switch (action) {
    case ZOOM_H_ENL:
        MouseZoom(-120, true, false);
        break;
    case ZOOM_H_RED:
        MouseZoom(120, true, false);
        break;
    case ZOOM_V_ENL:
        MouseZoom(-120, false, true);
        break;
    case ZOOM_V_RED:
        MouseZoom(120, false, true);
        break;
    case SCROLL_LEFT:
        ScatterDraw::Scroll(0.2, 0);
        break;
    case SCROLL_RIGHT:
        ScatterDraw::Scroll(-0.2, 0);
        break;
    case SCROLL_UP:
        ScatterDraw::Scroll(0, -0.2);
        break;
    case SCROLL_DOWN:
        ScatterDraw::Scroll(0, 0.2);
        break;
    case NO_ACTION:
        ;
    }
}
예제 #3
0
void MayaCamera::OnUpdate(TimeStep timeStep)
{

	const Application& app = Application::GetApplication();

	if (app.IsKeyPressed(GLFW_KEY_LEFT_ALT))
	{
		const vec2& mouse = app.GetMousePos();
		vec2 delta = mouse - m_InitialMousePosition;
		m_InitialMousePosition = mouse;
		
		if (app.GetMouseButton() == GLFW_MOUSE_BUTTON_MIDDLE)
			MousePan(delta);
		else if (app.GetMouseButton() == GLFW_MOUSE_BUTTON_LEFT)
			MouseRotate(delta);
		else if (app.GetMouseButton() == GLFW_MOUSE_BUTTON_RIGHT)
			MouseZoom(delta.y);
	}

	// MouseZoom(window->GetMouseScrollPosition().y);

	m_Position = CalculatePosition();

	Quaternion orientation = GetOrientation();
	m_Rotation = orientation.ToEulerAngles() * (180.0f / 3.14f);

	m_View = mat4::Translate(vec3(0, 0, 1)) * mat4::Rotate(orientation.Conjugate()) * mat4::Translate(-m_Position);
}
예제 #4
0
bool psMovementManager::HandleEvent( iEvent &event )
{
    if (!ready || !actor)  // Not fully loaded yet
        return false;

    if (event.Name == event_frame)
    {
        // If we've returned to the ground, update allowed velocity
        if ((!onGround && actor->Movement().IsOnGround()) ||
                (onGround && !actor->Movement().IsOnGround()))
            UpdateVelocity();

            // UpdateMouseLook will take care of "recent mouse-look turning" based on "bool mouseLook"
            UpdateMouseLook();

        if (mouseMove)
            UpdateRunTo();
    }
    else if (event.Name == event_mousemove)
    {
        if (mouseLook)
            MouseLook(event);
        else if (mouseZoom)
            MouseZoom(event);
    }

    return false;
}