MCPcopy Index your code
hub / github.com/rawpython/remi / on_drag

Method on_drag

editor/editor.py:127–141  ·  view source on GitHub ↗
(self, emitter, x, y)

Source from the content-addressed store, hash-verified

125 DraggableItem.setup(self, refWidget, newParent)
126
127 def on_drag(self, emitter, x, y):
128 if self.active:
129 if self.origin_x == -1:
130 self.origin_x = float(x)
131 self.origin_y = float(y)
132 self.refWidget_origin_x = float(
133 self.refWidget.attributes[self.name_coord_x])
134 self.refWidget_origin_y = float(
135 self.refWidget.attributes[self.name_coord_y])
136 else:
137 self.refWidget.attributes[self.name_coord_x] = self.round_grid(
138 self.refWidget_origin_x + float(x) - self.origin_x)
139 self.refWidget.attributes[self.name_coord_y] = self.round_grid(
140 self.refWidget_origin_y + float(y) - self.origin_y)
141 self.update_position()
142
143 def update_position(self):
144 if self.refWidget:

Callers

nothing calls this directly

Calls 2

update_positionMethod · 0.95
round_gridMethod · 0.80

Tested by

no test coverage detected