Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def stop_dragging(self):
self.dragging = False
self.delta_drag = self.world_position - self.start_pos
Draggable._z_plane.enabled = False
self.collision = True
mouse.traverse_target = scene
if hasattr(self, 'drop'):
self.drop()
def start_dragging(self):
Draggable._z_plane.world_position = mouse.world_point
Draggable._z_plane.look_at(Draggable._z_plane.position - Vec3(*self.plane_direction))
if self.has_ancestor(camera.ui):
Draggable._z_plane.world_parent = camera.ui
else:
Draggable._z_plane.world_parent = scene
self.start_offset = mouse.world_point - self.world_position
self.dragging = True
self.start_pos = self.world_position
self.collision = False
Draggable._z_plane.enabled = True
mouse.traverse_target = Draggable._z_plane
try:
self.drag()
except:
pass
self.require_key = None
self.dragging = False
self.delta_drag = 0
self.start_pos = self.world_position
self.start_offset = (0,0,0)
self.step = (0,0,0)
self.plane_direction = (0,0,1)
self.lock_x = False
self.lock_y = False
self.lock_z = False
self.min_x, self.min_y, self.min_z = -math.inf, -math.inf, -math.inf
self.max_x, self.max_y, self.max_z = math.inf, math.inf, math.inf
if not Draggable._z_plane.model: # set these after game start so it can load the model
Draggable._z_plane.model = 'quad'
Draggable._z_plane.collider = 'box'
Draggable._z_plane.color = color.clear
for key, value in kwargs.items():
if key == 'collider' and value == 'sphere' and self.has_ancestor(camera.ui):
print('error: sphere colliders are not supported on Draggables in ui space.')
if key == 'text' or key in self.attributes:
continue
setattr(self, key, value)
self.dragging = False
self.delta_drag = 0
self.start_pos = self.world_position
self.start_offset = (0,0,0)
self.step = (0,0,0)
self.plane_direction = (0,0,1)
self.lock_x = False
self.lock_y = False
self.lock_z = False
self.min_x, self.min_y, self.min_z = -math.inf, -math.inf, -math.inf
self.max_x, self.max_y, self.max_z = math.inf, math.inf, math.inf
if not Draggable._z_plane.model: # set these after game start so it can load the model
Draggable._z_plane.model = 'quad'
Draggable._z_plane.collider = 'box'
Draggable._z_plane.color = color.clear
for key, value in kwargs.items():
if key == 'collider' and value == 'sphere' and self.has_ancestor(camera.ui):
print('error: sphere colliders are not supported on Draggables in ui space.')
if key == 'text' or key in self.attributes:
continue
setattr(self, key, value)
def start_dragging(self):
Draggable._z_plane.world_position = mouse.world_point
Draggable._z_plane.look_at(Draggable._z_plane.position - Vec3(*self.plane_direction))
if self.has_ancestor(camera.ui):
Draggable._z_plane.world_parent = camera.ui
else:
Draggable._z_plane.world_parent = scene
self.start_offset = mouse.world_point - self.world_position
self.dragging = True
self.start_pos = self.world_position
self.collision = False
Draggable._z_plane.enabled = True
mouse.traverse_target = Draggable._z_plane
try:
self.drag()
except:
pass
def start_dragging(self):
Draggable._z_plane.world_position = mouse.world_point
Draggable._z_plane.look_at(Draggable._z_plane.position - Vec3(*self.plane_direction))
if self.has_ancestor(camera.ui):
Draggable._z_plane.world_parent = camera.ui
else:
Draggable._z_plane.world_parent = scene
self.start_offset = mouse.world_point - self.world_position
self.dragging = True
self.start_pos = self.world_position
self.collision = False
Draggable._z_plane.enabled = True
mouse.traverse_target = Draggable._z_plane
try:
self.drag()
except:
pass
def start_dragging(self):
Draggable._z_plane.world_position = mouse.world_point
Draggable._z_plane.look_at(Draggable._z_plane.position - Vec3(*self.plane_direction))
if self.has_ancestor(camera.ui):
Draggable._z_plane.world_parent = camera.ui
else:
Draggable._z_plane.world_parent = scene
self.start_offset = mouse.world_point - self.world_position
self.dragging = True
self.start_pos = self.world_position
self.collision = False
Draggable._z_plane.enabled = True
mouse.traverse_target = Draggable._z_plane
try:
self.drag()
except:
pass
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.require_key = None
self.dragging = False
self.delta_drag = 0
self.start_pos = self.world_position
self.start_offset = (0,0,0)
self.step = (0,0,0)
self.plane_direction = (0,0,1)
self.lock_x = False
self.lock_y = False
self.lock_z = False
self.min_x, self.min_y, self.min_z = -math.inf, -math.inf, -math.inf
self.max_x, self.max_y, self.max_z = math.inf, math.inf, math.inf
if not Draggable._z_plane.model: # set these after game start so it can load the model
Draggable._z_plane.model = 'quad'
Draggable._z_plane.collider = 'box'
Draggable._z_plane.color = color.clear
for key, value in kwargs.items():
if key == 'collider' and value == 'sphere' and self.has_ancestor(camera.ui):
print('error: sphere colliders are not supported on Draggables in ui space.')
if key == 'text' or key in self.attributes:
continue
setattr(self, key, value)