hover_handle Subroutine

private subroutine hover_handle(self, x, y)

The handle under (x, y), if any, hovered (the one before not), and the grab armed for it. Of handles on the same spot: the nearest on the screen; within same_spot pixels of it, the highest priority, then the nearest to the eye (vkf_handles).

Arguments

Type IntentOptional Attributes Name
class(WindowProxy), intent(inout), target :: self
real(kind=wp), intent(in) :: x

the cursor: -1 to 1 across the window, y up

real(kind=wp), intent(in) :: y

the cursor: -1 to 1 across the window, y up


Calls

proc~~hover_handle~~CallsGraph proc~hover_handle hover_handle draggable draggable proc~hover_handle->draggable interface~vkf_viewer_set_grab vkf_viewer_set_grab proc~hover_handle->interface~vkf_viewer_set_grab priority priority proc~hover_handle->priority proc~handles_shown handles_shown proc~hover_handle->proc~handles_shown proc~set_hovered DragHandle%set_hovered proc~hover_handle->proc~set_hovered proc~window_pick WindowProxy%window_pick proc~hover_handle->proc~window_pick show_state show_state proc~set_hovered->show_state proc~child ReferenceFrame%child proc~window_pick->proc~child proc~fm_frame FrameManager%fm_frame proc~window_pick->proc~fm_frame proc~identity_matrix identity_matrix proc~window_pick->proc~identity_matrix proc~local_matrix ReferenceFrame%local_matrix proc~window_pick->proc~local_matrix proc~num_children ReferenceFrame%num_children proc~window_pick->proc~num_children proc~pick ReferenceFrame%pick proc~window_pick->proc~pick proc~pickable ReferenceFrame%pickable proc~window_pick->proc~pickable proc~view_camera view_camera proc~window_pick->proc~view_camera proc~frame_matrix frame_matrix proc~local_matrix->proc~frame_matrix proc~add_pick_hit add_pick_hit proc~pick->proc~add_pick_hit proc~point_pick point_pick proc~pick->proc~point_pick proc~wants wants proc~pick->proc~wants interface~vkf_viewer_pixel_ratio vkf_viewer_pixel_ratio proc~view_camera->interface~vkf_viewer_pixel_ratio interface~vkf_viewer_size vkf_viewer_size proc~view_camera->interface~vkf_viewer_size proc~aspect_ratio aspect_ratio proc~view_camera->proc~aspect_ratio proc~field_of_view View%field_of_view proc~view_camera->proc~field_of_view proc~get_camera WindowProxy%get_camera proc~view_camera->proc~get_camera proc~is_open WindowProxy%is_open proc~view_camera->proc~is_open proc~orthographic_bounds View%orthographic_bounds proc~view_camera->proc~orthographic_bounds proc~pick_camera pick_camera proc~view_camera->proc~pick_camera proc~projection_type View%projection_type proc~view_camera->proc~projection_type proc~aspect_ratio->interface~vkf_viewer_size proc~quat_to_matrix quat_to_matrix proc~frame_matrix->proc~quat_to_matrix proc~get_camera->proc~is_open interface~vkf_viewer_get_look_at vkf_viewer_get_look_at proc~get_camera->interface~vkf_viewer_get_look_at proc~rigid_inverse rigid_inverse proc~get_camera->proc~rigid_inverse proc~transform_camera transform_camera proc~get_camera->proc~transform_camera proc~world_to_view View%world_to_view proc~get_camera->proc~world_to_view proc~cross cross proc~pick_camera->proc~cross proc~project project proc~point_pick->proc~project proc~world_to_view->proc~identity_matrix proc~world_to_view->proc~quat_to_matrix proc~world_to_view->proc~rigid_inverse proc~frame_to_root frame_to_root proc~world_to_view->proc~frame_to_root proc~quat_from_vectors quat_from_vectors proc~world_to_view->proc~quat_from_vectors proc~rotated rotated proc~world_to_view->proc~rotated proc~translation_matrix translation_matrix proc~world_to_view->proc~translation_matrix proc~frame_to_root->proc~rigid_inverse proc~world_matrix ReferenceFrame%world_matrix proc~frame_to_root->proc~world_matrix proc~quat_from_vectors->proc~cross proc~quat_normalize quat_normalize proc~quat_from_vectors->proc~quat_normalize proc~translation_matrix->proc~identity_matrix proc~world_matrix->proc~local_matrix proc~world_matrix->proc~world_matrix

Called by

proc~~hover_handle~~CalledByGraph proc~hover_handle hover_handle proc~dispatch_event dispatch_event proc~dispatch_event->proc~hover_handle proc~release_handle release_handle proc~dispatch_event->proc~release_handle proc~release_handle->proc~hover_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

    subroutine hover_handle(self, x, y)
        class(WindowProxy), intent(inout), target :: self
        real(wp), intent(in) :: x, y                        !! the cursor: -1 to 1 across the window, y up
        real(wp), parameter :: same_spot = 3.0_wp           !! framebuffer pixels
        type(PickHit), allocatable :: hits(:)
        class(DragHandle), pointer :: found
        real(wp) :: least
        integer :: k
        found => null()
        if (handles_shown()) then
            call self%pick(x, y, hits, kinds=[PICK_HANDLE])
            if (size(hits) > 0) least = minval(hits%pixels)
            do k = 1, size(hits)                            ! (nearest to the eye first)
                if (hits(k)%pixels > least + same_spot) cycle
                select type (f => hits(k)%frame)
                class is (DragHandle)
                    if (.not. f%draggable()) cycle
                    if (associated(found)) then
                        if (f%priority() <= found%priority()) cycle
                    end if
                    found => f
                end select
            end do
        end if
        if (associated(found, self%hovered_handle)) return
        if (associated(self%hovered_handle)) call self%hovered_handle%set_hovered(.false.)
        self%hovered_handle => found
        if (associated(found)) call found%set_hovered(.true.)
        if (vkf_viewer_set_grab(self%viewer_, merge(1_c_int, 0_c_int, associated(found))) /= 0) &
            write(*, '(a)') 'vkframes: could not arm a grab'
    end subroutine hover_handle