| 3071 | } |
| 3072 | |
| 3073 | void PythonEditor::processRmlEvent(Rml::Element& element, Rml::Event& event) { |
| 3074 | if (!impl_ || !impl_->editor) { |
| 3075 | return; |
| 3076 | } |
| 3077 | |
| 3078 | const std::string type = event.GetType(); |
| 3079 | const auto local_mouse = [&]() { |
| 3080 | const auto offset = element.GetAbsoluteOffset(Rml::BoxArea::Content); |
| 3081 | return Zep::NVec2f{ |
| 3082 | event.GetParameter("mouse_x", 0.0f) - offset.x, |
| 3083 | event.GetParameter("mouse_y", 0.0f) - offset.y, |
| 3084 | }; |
| 3085 | }; |
| 3086 | |
| 3087 | if (type == "focus") { |
| 3088 | impl_->is_focused = true; |
| 3089 | impl_->force_unfocused = false; |
| 3090 | return; |
| 3091 | } |
| 3092 | if (type == "blur") { |
| 3093 | impl_->is_focused = false; |
| 3094 | impl_->mouse_pos_valid = false; |
| 3095 | impl_->endMouseSelection(); |
| 3096 | impl_->completion.clear(); |
| 3097 | return; |
| 3098 | } |
| 3099 | |
| 3100 | if (type == "drag") { |
| 3101 | const auto mouse = local_mouse(); |
| 3102 | impl_->mouse_x = mouse.x; |
| 3103 | impl_->mouse_y = mouse.y; |
| 3104 | impl_->mouse_pos_valid = true; |
| 3105 | if (impl_->updateMouseSelection(mouse)) { |
| 3106 | event.StopPropagation(); |
| 3107 | return; |
| 3108 | } |
| 3109 | impl_->editor->OnMouseMove(mouse); |
| 3110 | event.StopPropagation(); |
| 3111 | return; |
| 3112 | } |
| 3113 | |
| 3114 | if (type == "dragend") { |
| 3115 | impl_->endMouseSelection(); |
| 3116 | event.StopPropagation(); |
| 3117 | return; |
| 3118 | } |
| 3119 | |
| 3120 | if (type == "mousemove") { |
| 3121 | const auto mouse = local_mouse(); |
| 3122 | impl_->mouse_x = mouse.x; |
| 3123 | impl_->mouse_y = mouse.y; |
| 3124 | impl_->mouse_pos_valid = true; |
| 3125 | if (impl_->mouse_selecting && impl_->updateMouseSelection(mouse)) { |
| 3126 | event.StopPropagation(); |
| 3127 | return; |
| 3128 | } |
| 3129 | impl_->editor->OnMouseMove(mouse); |
| 3130 | event.StopPropagation(); |
no test coverage detected