コード例 #1
0
ファイル: controller.cpp プロジェクト: reuk/wayverb
 void mouse_drag(const MouseEvent& e) override {
     if (auto strong = item_.lock()) {
         const auto initial = compute_world_mouse_position(glm::vec2{
                 e.getMouseDownPosition().x, e.getMouseDownPosition().y});
         const auto current = compute_world_mouse_position(
                 glm::vec2{e.getPosition().x, e.getPosition().y});
         const auto new_pos = initial_position_ + current - initial;
         strong->set_position(new_pos);
     }
 }
コード例 #2
0
ファイル: controller.cpp プロジェクト: reuk/wayverb
 void mouse_drag(const MouseEvent& e) override {
     //  Find mouse position on plane perpendicular to camera direction
     //  through the rotation origin.
     const auto initial = compute_world_mouse_position(glm::vec2{
             e.getMouseDownPosition().x, e.getMouseDownPosition().y});
     const auto current = compute_world_mouse_position(
             glm::vec2{e.getPosition().x, e.getPosition().y});
     //  Adjust the model origin based on the difference between the initial
     //  and current mouse positions.
     model_.set_origin(initial_position_ + current - initial);
 }
コード例 #3
0
void ObjectsHolder::mouseDown(const MouseEvent& e)
{
    if (e.mods.isPopupMenu() && objController.getSelectedObjects().getNumSelected() == 2)
    {
        String startObj;
        String endObj;
        if (objController.getSelectedObjects().getNumSelected() == 2)
        {
            ObjectComponent* oc1 = dynamic_cast<ObjectComponent*>(objController.getSelectedObjects().getSelectedItem(0));
            ObjectComponent* oc2 = dynamic_cast<ObjectComponent*>(objController.getSelectedObjects().getSelectedItem(1));
            if(oc1 != nullptr && oc2 != nullptr)
            {
                startObj = oc1->getData().getProperty(Ids::identifier).toString();
                endObj = oc2->getData().getProperty(Ids::identifier).toString();
                DBG(String("Link: ") + startObj + String(", ") + endObj);
                showLinkPopupMenu(startObj, endObj);
            }
        }

    }
    else if (e.mods.isPopupMenu())
    {
        showContextMenu(e.getMouseDownPosition());
    }
    else
    {
        addAndMakeVisible(&lassoComp);
        lassoComp.beginLasso(e, this);
    }
}
コード例 #4
0
void imaphone_component::mouseUp (const MouseEvent& e)
{
    //[UserCode_mouseUp] -- Add your code here...
	if (color_preview->getBounds().contains(e.getMouseDownPosition())) {
		image->set_color_full_preview(false);
		color_preview->setToggleState(false, NotificationType::dontSendNotification);
	}
    //[/UserCode_mouseUp]
}
コード例 #5
0
ファイル: CustomKeyboard.cpp プロジェクト: azeteg/HISE
void CustomKeyboard::mouseDown(const MouseEvent& e)
{
	if (toggleMode)
	{
		auto number = getNoteAtPosition(e.getMouseDownPosition());

		if (state->isNoteOnForChannels(getMidiChannelsToDisplay(), number))
		{
			state->noteOff(getMidiChannel(), number, 1.0f);
		}
		else
		{
			state->noteOn(getMidiChannel(), number, 1.0f);
		}
	}
	else
	{
		MidiKeyboardComponent::mouseDown(e);
	}
	
}