MCPcopy Create free account
hub / github.com/Kitware/VTK / mouseInteraction

Method mouseInteraction

Web/Python/vtkmodules/web/protocols.py:104–152  ·  view source on GitHub ↗

RPC Callback for mouse interactions.

(self, event)

Source from the content-addressed store, hash-verified

102class vtkWebMouseHandler(vtkWebProtocol):
103 @exportRpc("viewport.mouse.interaction")
104 def mouseInteraction(self, event):
105 """
106 RPC Callback for mouse interactions.
107 """
108 view = self.getView(event["view"])
109
110 buttons = 0
111 if event["buttonLeft"]:
112 buttons |= vtkWebInteractionEvent.LEFT_BUTTON
113 if event["buttonMiddle"]:
114 buttons |= vtkWebInteractionEvent.MIDDLE_BUTTON
115 if event["buttonRight"]:
116 buttons |= vtkWebInteractionEvent.RIGHT_BUTTON
117
118 modifiers = 0
119 if event["shiftKey"]:
120 modifiers |= vtkWebInteractionEvent.SHIFT_KEY
121 if event["ctrlKey"]:
122 modifiers |= vtkWebInteractionEvent.CTRL_KEY
123 if event["altKey"]:
124 modifiers |= vtkWebInteractionEvent.ALT_KEY
125 if event["metaKey"]:
126 modifiers |= vtkWebInteractionEvent.META_KEY
127
128 pvevent = vtkWebInteractionEvent()
129 pvevent.SetButtons(buttons)
130 pvevent.SetModifiers(modifiers)
131 if "x" in event:
132 pvevent.SetX(event["x"])
133 if "y" in event:
134 pvevent.SetY(event["y"])
135 if "scroll" in event:
136 pvevent.SetScroll(event["scroll"])
137 if event["action"] == "dblclick":
138 pvevent.SetRepeatCount(2)
139 # pvevent.SetKeyCode(event["charCode"])
140 retVal = self.getApplication().HandleInteractionEvent(view, pvevent)
141 del pvevent
142
143 if event["action"] == "down":
144 self.getApplication().InvokeEvent("StartInteractionEvent")
145
146 if event["action"] == "up":
147 self.getApplication().InvokeEvent("EndInteractionEvent")
148
149 if retVal:
150 self.getApplication().InvokeEvent("UpdateEvent")
151
152 return retVal
153
154 @exportRpc("viewport.mouse.zoom.wheel")
155 def updateZoomFromWheel(self, event):

Callers

nothing calls this directly

Calls 7

getViewMethod · 0.80
InvokeEventMethod · 0.80
SetXMethod · 0.45
SetYMethod · 0.45
getApplicationMethod · 0.45

Tested by

no test coverage detected