-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathInputManager.cpp
581 lines (478 loc) · 21.7 KB
/
InputManager.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
////////////////////////////////////////////////////////////////////////////////////////////////////
// This file is part of CosmoScout VR //
////////////////////////////////////////////////////////////////////////////////////////////////////
// SPDX-FileCopyrightText: German Aerospace Center (DLR) <[email protected]>
// SPDX-License-Identifier: MIT
#include "InputManager.hpp"
#include "../cs-gui/GuiItem.hpp"
#include "../cs-gui/ScreenSpaceGuiArea.hpp"
#include "../cs-gui/WorldSpaceGuiArea.hpp"
#include "../cs-utils/utils.hpp"
#include "GuiManager.hpp"
#include "logger.hpp"
#include <VistaDataFlowNet/VdfnNode.h>
#include <VistaDataFlowNet/VdfnObjectRegistry.h>
#include <VistaDataFlowNet/VdfnPort.h>
#include <VistaKernel/DisplayManager/SDL2WindowImp/VistaSDL2WindowingToolkit.h>
#include <VistaKernel/DisplayManager/VistaDisplayManager.h>
#include <VistaKernel/DisplayManager/VistaDisplaySystem.h>
#include <VistaKernel/DisplayManager/VistaProjection.h>
#include <VistaKernel/DisplayManager/VistaViewport.h>
#include <VistaKernel/DisplayManager/VistaVirtualPlatform.h>
#include <VistaKernel/EventManager/VistaEventManager.h>
#include <VistaKernel/GraphicsManager/VistaGeomNode.h>
#include <VistaKernel/GraphicsManager/VistaGeometryFactory.h>
#include <VistaKernel/GraphicsManager/VistaGraphicsManager.h>
#include <VistaKernel/GraphicsManager/VistaOpenGLNode.h>
#include <VistaKernel/GraphicsManager/VistaSceneGraph.h>
#include <VistaKernel/GraphicsManager/VistaTransformNode.h>
#include <VistaKernel/InteractionManager/VistaInteractionEvent.h>
#include <VistaKernel/InteractionManager/VistaInteractionManager.h>
#include <VistaKernel/VistaSystem.h>
#include <VistaKernelOpenSGExt/VistaOpenSGMaterialTools.h>
namespace cs::core {
////////////////////////////////////////////////////////////////////////////////////////////////////
InputManager::InputManager(std::shared_ptr<Settings> settings)
: mSettings(std::move(settings)) {
// Tell the user what's going on.
logger().debug("Creating InputManager.");
mClickTime = boost::posix_time::microsec_clock::universal_time();
auto* pSG = GetVistaSystem()->GetGraphicsManager()->GetSceneGraph();
float const selectionHeight = 10.0F;
float const selectionRadius = 0.3F;
// Configure selection volume.
VistaEvenCone selectionVolume(selectionHeight, selectionRadius);
mSelection.SetSelectionVolume(selectionVolume);
mSelection.SetStickyness(0.5F);
mSelection.SetSnappiness(0.5F);
// Add selection ray to scenegraph.
VistaGeometryFactory oGeometryFactory(pSG);
VistaTransformNode* pIntentionNode =
pSG->NewTransformNode(dynamic_cast<VistaGroupNode*>(pSG->GetNode("Virtualplatform-Node")));
pIntentionNode->SetName("SELECTION_NODE");
GetVistaSystem()->GetDfnObjectRegistry()->SetObject("SELECTION_NODE", nullptr, pIntentionNode);
// Unbind q-action.
GetVistaSystem()->GetKeyboardSystemControl()->UnbindAction('q');
// Copy, paste, ctr-z,...
GetVistaSystem()->GetKeyboardSystemControl()->BindAction('x', VISTA_KEYMOD_CTRL, [this]() {
if (pSelectedGuiItem.get()) {
pSelectedGuiItem.get()->cut();
}
});
GetVistaSystem()->GetKeyboardSystemControl()->BindAction('c', VISTA_KEYMOD_CTRL, [this]() {
if (pSelectedGuiItem.get()) {
pSelectedGuiItem.get()->copy();
}
});
GetVistaSystem()->GetKeyboardSystemControl()->BindAction('v', VISTA_KEYMOD_CTRL, [this]() {
if (pSelectedGuiItem.get()) {
pSelectedGuiItem.get()->paste();
}
});
GetVistaSystem()->GetKeyboardSystemControl()->BindAction('z', VISTA_KEYMOD_CTRL, [this]() {
if (pSelectedGuiItem.get()) {
pSelectedGuiItem.get()->undo();
}
});
GetVistaSystem()->GetKeyboardSystemControl()->BindAction('y', VISTA_KEYMOD_CTRL, [this]() {
if (pSelectedGuiItem.get()) {
pSelectedGuiItem.get()->redo();
}
});
GetVistaSystem()->GetKeyboardSystemControl()->BindAction('a', VISTA_KEYMOD_CTRL, [this]() {
if (pSelectedGuiItem.get()) {
pSelectedGuiItem.get()->selectAll();
}
});
// Remove intersection if corresponding object is removed from the settings.
mRemoveObjectConnection =
mSettings->mObjects.onRemove().connect([this](auto const& name, auto const& object) {
if (pHoveredObject.get().mObject == object) {
pHoveredObject = Intersection();
}
});
// Register handler and events.
GetVistaSystem()->GetKeyboardSystemControl()->SetDirectKeySink(this);
GetVistaSystem()->GetEventManager()->AddEventHandler(
this, VistaInteractionEvent::GetTypeId(), VistaInteractionEvent::VEID_GRAPH_INPORT_CHANGE);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
InputManager::~InputManager() {
// Tell the user what's going on.
logger().debug("Deleting InputManager.");
for (auto* adapter : mAdapters) {
mSelection.UnregisterNode(adapter);
delete adapter; // NOLINT(cppcoreguidelines-owning-memory): unordered_set doesn't like smart
// pointers.
}
mSettings->mObjects.onRemove().disconnect(mRemoveObjectConnection);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
void InputManager::registerSelectable(gui::ScreenSpaceGuiArea* pGui) {
if (pGui) {
mScreenSpaceGuis.insert(pGui);
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////
void InputManager::registerSelectable(IVistaNode* pNode) {
if ((pNode->GetType() == VISTA_GEOMNODE || pNode->GetType() == VISTA_OPENGLNODE)) {
auto* pAdapter = new VistaBoundingBoxAdapter(pNode); // NOLINT(cppcoreguidelines-owning-memory):
// std::set doesn't like smart pointers.
mSelection.RegisterNode(pAdapter);
mAdapters.insert(pAdapter);
} else {
auto* pAdapter = new VistaNodeAdapter(pNode); // NOLINT(cppcoreguidelines-owning-memory):
// std::set doesn't like smart pointers.
mSelection.RegisterNode(pAdapter);
mAdapters.insert(pAdapter);
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////
void InputManager::unregisterSelectable(gui::ScreenSpaceGuiArea* pGui) {
if (pGui) {
if (utils::contains(pGui->getItems(), pHoveredGuiItem.get())) {
pHoveredGuiItem = nullptr;
}
if (utils::contains(pGui->getItems(), pSelectedGuiItem.get())) {
pSelectedGuiItem = nullptr;
}
if (utils::contains(pGui->getItems(), pActiveGuiItem.get())) {
pActiveGuiItem = nullptr;
}
mScreenSpaceGuis.erase(pGui);
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////
void InputManager::unregisterSelectable(IVistaNode* pNode) {
if (pHoveredNode.get() == pNode) {
pHoveredNode = nullptr;
}
if (pSelectedNode.get() == pNode) {
pSelectedNode = nullptr;
}
if (pActiveNode.get() == pNode) {
pActiveNode = nullptr;
}
auto* pOGLNode = dynamic_cast<VistaOpenGLNode*>(pNode);
// If its an OpenGLNode, it may be a gui element.
if (pOGLNode) {
auto* area = dynamic_cast<gui::WorldSpaceGuiArea*>(pOGLNode->GetExtension());
if (area) {
if (utils::contains(area->getItems(), pHoveredGuiItem.get())) {
pHoveredGuiItem = nullptr;
}
if (utils::contains(area->getItems(), pSelectedGuiItem.get())) {
pSelectedGuiItem = nullptr;
}
if (utils::contains(area->getItems(), pActiveGuiItem.get())) {
pActiveGuiItem = nullptr;
}
}
}
if (pNode) {
for (auto* pAdapter : mAdapters) {
if (pAdapter->GetNode() == pNode) {
mSelection.UnregisterNode(pAdapter);
delete pAdapter; // NOLINT(cppcoreguidelines-owning-memory): unordered_set doesn't like
// smart pointers.
mAdapters.erase(pAdapter);
return;
}
}
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////
void InputManager::update() {
auto* pSG = GetVistaSystem()->GetGraphicsManager()->GetSceneGraph();
// Set position and orientation of selection ray.
VistaVector3D v3Position;
VistaQuaternion qOrientation;
VistaTransformNode* pIntentionNode =
dynamic_cast<VistaTransformNode*>(pSG->GetNode("SELECTION_NODE"));
pIntentionNode->GetWorldPosition(v3Position);
pIntentionNode->GetWorldOrientation(qOrientation);
VistaVector3D v3Direction = qOrientation.GetViewDir();
// Test the Intention Node for Intersection with planets.
Intersection intersection;
for (auto const& [name, object] : mSettings->mObjects) {
if (object->getIntersectableObject()) {
glm::dvec3 pos(0.0, 0.0, 0.0);
bool intersects = object->getIntersectableObject()->getIntersection(
glm::dvec3(v3Position[0], v3Position[1], v3Position[2]),
glm::dvec3(v3Direction[0], v3Direction[1], v3Direction[2]), pos);
if (intersects) {
intersection.mObject = object;
intersection.mObjectName = name;
intersection.mPosition = pos;
break;
}
}
}
pHoveredObject = intersection;
// If there is an active node, we do not want to change any selection state.
if (pActiveNode.get()) {
return;
}
// Test the Intention Node for Intersection with screen space gui.
if (!mScreenSpaceGuis.empty()) {
VistaViewport* pViewport(GetVistaSystem()->GetDisplayManager()->GetViewports().begin()->second);
auto* pProbs = pViewport->GetProjection()->GetProjectionProperties();
VistaVector3D v3Origin;
VistaVector3D v3Up;
VistaVector3D v3Normal;
double dLeft{};
double dRight{};
double dBottom{};
double dTop{};
pProbs->GetProjPlaneExtents(dLeft, dRight, dBottom, dTop);
pProbs->GetProjPlaneMidpoint(v3Origin[0], v3Origin[1], v3Origin[2]);
pProbs->GetProjPlaneUp(v3Up[0], v3Up[1], v3Up[2]);
pProbs->GetProjPlaneNormal(v3Normal[0], v3Normal[1], v3Normal[2]);
auto* platformTransform =
GetVistaSystem()->GetDisplayManager()->GetDisplaySystem()->GetReferenceFrame();
VistaVector3D start = v3Position;
VistaVector3D end = (v3Position + qOrientation.GetViewDir());
start = platformTransform->TransformPositionToFrame(start);
end = platformTransform->TransformPositionToFrame(end);
VistaVector3D direction(end - start);
VistaRay ray(start, direction);
VistaPlane plane(v3Origin, v3Up.Cross(v3Normal), v3Up, v3Normal);
VistaVector3D guiIntersection;
if (plane.CalcIntersection(ray, guiIntersection)) {
for (auto const& pViewportGui : mScreenSpaceGuis) {
int x = static_cast<int>(
(guiIntersection[0] - dLeft) / (dRight - dLeft) * pViewportGui->getWidth());
int y = static_cast<int>(
(1.0 - (guiIntersection[1] - dBottom) / (dTop - dBottom)) * pViewportGui->getHeight());
if (pActiveGuiItem.get()) {
// If there is an active gui item we need to send mouse move events even if it's not
// hovered. So we check whether the current screen space gui area contains this active
// item.
if (utils::contains(pViewportGui->getItems(), pActiveGuiItem.get())) {
// If so, we send the mouse move and are done.
gui::MouseEvent event;
pActiveGuiItem.get()->calculateMousePosition(x, y, event.mX, event.mY);
pActiveGuiItem.get()->injectMouseEvent(event);
return;
}
} else {
// If there is no active gui item, we should check if the mouse pointer is currently
// hovering an item.
auto* item = pViewportGui->getItemAt(x, y);
if (item) {
// We have hovered gui item! Let's update the selection state as depicted in the diagram
// in InputManager.hpp.
pHoveredGuiItem = item;
pHoveredNode = nullptr;
gui::MouseEvent event;
item->calculateMousePosition(x, y, event.mX, event.mY);
item->injectMouseEvent(event);
return;
}
}
}
}
}
// Now we are sure that there is no active gui item of a screen space gui area. If there is an
// active gui item in a Worldspace gui area, we want to send the mouse input to it in all cases.
// So we can skip any later intersection calculation.
if (pActiveGuiItem.get()) {
VistaTransformMatrix matTransform;
mActiveWorldSpaceGuiNode->GetParentWorldTransform(matTransform);
auto* area = dynamic_cast<gui::WorldSpaceGuiArea*>(mActiveWorldSpaceGuiNode->GetExtension());
// We scale the gui element's transform matrix so that the translation magnitude becomes 1.f.
// This is not strictly necessary but reduces precision issues in the inversion of the matrix.
// Without this step, objects which are *really* far away would not be selectable.
VistaTransformMatrix matScale;
float scale = 1.F / matTransform.GetTranslation().GetLength();
matScale.SetToScaleMatrix(scale);
matTransform = matScale * matTransform;
VistaTransformMatrix matInvParentTransform = matTransform.GetInverted();
VistaVector3D start = matInvParentTransform * (v3Position * scale);
VistaVector3D end = matInvParentTransform * ((v3Position * scale) + qOrientation.GetViewDir());
int x{};
int y{};
area->calculateMousePosition(start, end, x, y);
// Inject a mouse move event.
gui::MouseEvent event;
pActiveGuiItem.get()->calculateMousePosition(x, y, event.mX, event.mY);
pActiveGuiItem.get()->injectMouseEvent(event);
return;
}
// There is no currently active object. So we can intersect our selectables to find potential
// candidates for hovering.
std::vector<IVistaIntentionSelectAdapter*> vResults;
mSelection.SetConeTransform(v3Position, qOrientation);
mSelection.Update(vResults);
for (auto* pNode : vResults) {
auto* pNodeAdapter = dynamic_cast<VistaNodeAdapter*>(pNode);
auto* pOGLNode = dynamic_cast<VistaOpenGLNode*>(pNodeAdapter->GetNode());
// If its an OpenGLNode, it may be a gui element.
gui::WorldSpaceGuiArea* area =
pOGLNode ? dynamic_cast<gui::WorldSpaceGuiArea*>(pOGLNode->GetExtension()) : nullptr;
if (area) {
VistaTransformMatrix matTransform;
pOGLNode->GetParentWorldTransform(matTransform);
// We scale the gui element's transform matrix so that the translation magnitude
// becomes 1.f. This is not strictly necessary but reduces precision issues in the
// inversion of the matrix. Without this step, objects which are *really* far away would
// not be selectable.
VistaTransformMatrix matScale;
float scale = 1.F / matTransform.GetTranslation().GetLength();
matScale.SetToScaleMatrix(scale);
matTransform = matScale * matTransform;
VistaTransformMatrix matInvParentTransform = matTransform.GetInverted();
VistaVector3D start = matInvParentTransform * (v3Position * scale);
VistaVector3D end =
matInvParentTransform * ((v3Position * scale) + qOrientation.GetViewDir());
int x{};
int y{};
if (area->calculateMousePosition(start, end, x, y)) {
gui::GuiItem* item = area->getItemAt(x, y);
// We found an intersected gui item! Let's inject a mouse move event and we are done.
if (item) {
pHoveredGuiItem = item;
pHoveredNode = nullptr;
mActiveWorldSpaceGuiNode = pOGLNode;
gui::MouseEvent event;
pHoveredGuiItem.get()->calculateMousePosition(x, y, event.mX, event.mY);
pHoveredGuiItem.get()->injectMouseEvent(event);
return;
}
}
// It's a gui node, but it's completely transparent, so look for the next object.
continue;
}
// It is definitely no gui item, so deselect any previous active element.
IVistaNode* pVistaNode = pNodeAdapter->GetNode();
if (pVistaNode) {
pHoveredNode = pVistaNode;
// De-hover any hovered gui items.
if (pHoveredGuiItem.get()) {
gui::MouseEvent event;
event.mType = gui::MouseEvent::Type::eLeave;
pHoveredGuiItem.get()->injectMouseEvent(event);
pHoveredGuiItem = nullptr;
GuiManager::setCursor(gui::Cursor::ePointer);
}
return;
}
}
// It seems nothing is hovered at all...
if (pHoveredGuiItem.get()) {
gui::MouseEvent event;
event.mType = gui::MouseEvent::Type::eLeave;
pHoveredGuiItem.get()->injectMouseEvent(event);
pHoveredGuiItem = nullptr;
GuiManager::setCursor(gui::Cursor::ePointer);
}
pHoveredNode = nullptr;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
bool InputManager::HandleKeyPress(int key, int mods, bool /*bIsKeyRepeat*/) {
if (key == VISTA_KEY_ESC) {
sOnEscapePressed.emit();
return true;
}
if (pSelectedGuiItem.get() && pSelectedGuiItem.get()->getIsKeyboardInputElementFocused()) {
pSelectedGuiItem.get()->injectKeyEvent(gui::KeyEvent(key, mods));
// Continue propagation for key-up events so that DFN realizes those even with the pointer being
// above the gui. Also, continue event propagation for ctrl-x, -c, -v, -z, -y, -a.
return !(key < 0 || (mods & VISTA_KEYMOD_CTRL && (key == 'x' || key == 'c' || key == 'v' ||
key == 'z' || key == 'y' || key == 'a')));
}
// Continue event propagation to DFN for navigation input if no gui input element has focus.
return false;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
// This implements the state transitions depicted in the diagram in InputManager.hpp which are
// labelled with "button press" and "button release".
template <typename T>
void handleButtonEvent(bool pressed, T& hovered, T& active, T& selected) {
if (pressed) {
if (hovered.get()) {
active = hovered;
selected = hovered;
} else if (selected.get()) {
selected = nullptr;
}
} else {
if (active.get()) {
active = nullptr;
}
}
}
void InputManager::HandleEvent(VistaEvent* pEvent) {
if (pEvent->GetId() == VistaInteractionEvent::VEID_GRAPH_INPORT_CHANGE) {
auto* event(dynamic_cast<VistaInteractionEvent*>(pEvent));
IVdfnNode const* node(event->GetEventNode());
std::string tag;
if (node->GetUserTag(tag)) {
for (size_t i(0); i < pButtons.size(); ++i) {
if (tag == "button_0" + std::to_string(i + 1)) {
auto* port(dynamic_cast<TVdfnPort<bool>*>(node->GetInPort("value")));
pButtons.at(i) = port->GetValue();
if (i == 0) {
// If the button is released and we have an active gui item, its active state will be
// reset. So we send a mouse release event before.
if (!port->GetValue() && pActiveGuiItem.get()) {
gui::MouseEvent mouseEvent;
mouseEvent.mButton = gui::Button::eLeft;
mouseEvent.mType = gui::MouseEvent::Type::eRelease;
pActiveGuiItem.get()->injectMouseEvent(mouseEvent);
}
// If we have a button press event for a selected but not hovered item, it will be
// un-selected. We should send focus-out event.
if (port->GetValue() && pSelectedGuiItem.get() &&
pSelectedGuiItem.get() != pHoveredGuiItem()) {
pSelectedGuiItem.get()->injectFocusEvent(false);
}
// If there is a hovered item which is not yet selected, we should send a focus-in
// event.
if (port->GetValue() && pHoveredGuiItem.get() &&
pSelectedGuiItem.get() != pHoveredGuiItem()) {
pHoveredGuiItem.get()->injectFocusEvent(true);
}
// Execute the state transitions as depicted in the diagram in InputManager.hpp. All
// transitions which are labelled with "button press" and "button release".
handleButtonEvent(port->GetValue(), pHoveredGuiItem, pActiveGuiItem, pSelectedGuiItem);
handleButtonEvent(port->GetValue(), pHoveredNode, pActiveNode, pSelectedNode);
// Now inject the button press event.
if (port->GetValue()) {
gui::MouseEvent mouseEvent;
mouseEvent.mButton = gui::Button::eLeft;
mouseEvent.mType = gui::MouseEvent::Type::ePress;
if (pActiveGuiItem.get()) {
pActiveGuiItem.get()->injectMouseEvent(mouseEvent);
} else if (pHoveredGuiItem.get()) {
pHoveredGuiItem.get()->injectMouseEvent(mouseEvent);
}
}
if (!port->GetValue()) {
auto t = boost::posix_time::microsec_clock::universal_time();
auto diff = (t - mClickTime);
int32_t const doubleClickTimeMillis = 200;
if (diff < boost::posix_time::time_duration(
boost::posix_time::millisec(doubleClickTimeMillis))) {
sOnDoubleClick.emit();
}
mClickTime = t;
}
}
}
}
if (tag == "scroll_wheel") {
TVdfnPort<int>* port(dynamic_cast<TVdfnPort<int>*>(node->GetInPort("value")));
auto* item = pActiveGuiItem.get() ? pActiveGuiItem.get() : pHoveredGuiItem.get();
if (port && item && item->getCanScroll()) {
gui::MouseEvent mouseEvent;
mouseEvent.mType = gui::MouseEvent::Type::eScroll;
mouseEvent.mY = port->GetValue() * 20;
item->injectMouseEvent(mouseEvent);
}
}
}
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////
} // namespace cs::core