MCPcopy Create free account
hub / github.com/VCVRack/Rack / onHoverKey

Method onHoverKey

src/ui/ScrollWidget.cpp:170–218  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

168
169
170void ScrollWidget::onHoverKey(const HoverKeyEvent& e) {
171 OpaqueWidget::onHoverKey(e);
172 if (e.isConsumed())
173 return;
174
175 // Check if scrollable
176 math::Rect offsetBound = getContainerOffsetBound();
177 if (offsetBound.size.x <= 0.f && offsetBound.size.y <= 0.f)
178 return;
179
180 if (e.action == GLFW_PRESS || e.action == GLFW_REPEAT) {
181 if (e.isKeyCommand(GLFW_KEY_PAGE_UP)) {
182 offset.y -= box.size.y * 0.5;
183 e.consume(this);
184 }
185 if (e.isKeyCommand(GLFW_KEY_PAGE_UP, GLFW_MOD_SHIFT)) {
186 offset.x -= box.size.x * 0.5;
187 e.consume(this);
188 }
189 if (e.isKeyCommand(GLFW_KEY_PAGE_DOWN)) {
190 offset.y += box.size.y * 0.5;
191 e.consume(this);
192 }
193 if (e.isKeyCommand(GLFW_KEY_PAGE_DOWN, GLFW_MOD_SHIFT)) {
194 offset.x += box.size.x * 0.5;
195 e.consume(this);
196 }
197 if (e.isKeyCommand(GLFW_KEY_HOME)) {
198 math::Rect containerBox = container->getVisibleChildrenBoundingBox();
199 offset.y = containerBox.getTop();
200 e.consume(this);
201 }
202 if (e.isKeyCommand(GLFW_KEY_HOME, GLFW_MOD_SHIFT)) {
203 math::Rect containerBox = container->getVisibleChildrenBoundingBox();
204 offset.x = containerBox.getLeft();
205 e.consume(this);
206 }
207 if (e.isKeyCommand(GLFW_KEY_END)) {
208 math::Rect containerBox = container->getVisibleChildrenBoundingBox();
209 offset.y = containerBox.getBottom();
210 e.consume(this);
211 }
212 if (e.isKeyCommand(GLFW_KEY_END, GLFW_MOD_SHIFT)) {
213 math::Rect containerBox = container->getVisibleChildrenBoundingBox();
214 offset.x = containerBox.getRight();
215 e.consume(this);
216 }
217 }
218}
219
220
221} // namespace ui

Callers

nothing calls this directly

Calls 8

isConsumedMethod · 0.80
isKeyCommandMethod · 0.80
consumeMethod · 0.80
getTopMethod · 0.80
getLeftMethod · 0.80
getBottomMethod · 0.80
getRightMethod · 0.80

Tested by

no test coverage detected