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); } }
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); }
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); } }
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] }
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); } }