drag Function

private function drag(self, origin, dir) result(moved)

Drag the grabbed handle to the cursor's ray (origin, unit dir; root frame), held to its constraint. False (and not moved) if it isn't grabbed or the ray doesn't meet the constraint.

Type Bound

DragHandle

Arguments

Type IntentOptional Attributes Name
class(DragHandle), intent(inout) :: self
real(kind=wp), intent(in) :: origin(3)

the cursor's ray (root frame)

real(kind=wp), intent(in) :: dir(3)

the cursor's ray (root frame)

Return Value logical


Calls

proc~~drag~~CallsGraph proc~drag DragHandle%drag move_handle_point move_handle_point proc~drag->move_handle_point proc~constrained constrained proc~drag->proc~constrained proc~world_matrix ReferenceFrame%world_matrix proc~drag->proc~world_matrix proc~ray_line ray_line proc~constrained->proc~ray_line proc~ray_plane ray_plane proc~constrained->proc~ray_plane proc~ray_sphere ray_sphere proc~constrained->proc~ray_sphere proc~world_matrix->proc~world_matrix proc~local_matrix ReferenceFrame%local_matrix proc~world_matrix->proc~local_matrix proc~frame_matrix frame_matrix proc~local_matrix->proc~frame_matrix proc~quat_to_matrix quat_to_matrix proc~frame_matrix->proc~quat_to_matrix

Called by

proc~~drag~~CalledByGraph proc~drag DragHandle%drag proc~drag_handle drag_handle proc~drag_handle->proc~drag proc~dispatch_event dispatch_event proc~dispatch_event->proc~drag_handle proc~dispatch_events dispatch_events proc~dispatch_events->proc~dispatch_event proc~frame WindowProxy%frame proc~frame->proc~dispatch_events proc~resize WindowProxy%resize proc~resize->proc~frame proc~run WindowProxy%run proc~run->proc~frame

Source Code

    logical function drag(self, origin, dir) result(moved)
        class(DragHandle), intent(inout) :: self
        real(wp), intent(in) :: origin(3), dir(3)           !! the cursor's ray (root frame)
        real(wp) :: h(3), p(3)
        moved = .false.
        if (.not. self%dragged_) return
        if (.not. constrained(self, origin, dir, self%world_matrix(), h)) return
        p = h + self%offset
        if (self%constraint_ == HANDLE_SPHERE .and. norm2(p) > 0.0_wp) p = self%radius * p / norm2(p)
        call self%move_handle_point(p)
        moved = .true.
    end function drag