(sender, app_data)
| 967 | |
| 968 | ### register camera handler |
| 969 | def callback_click_handler(sender, app_data): |
| 970 | if not dpg.is_item_focused("_primary_window") or not self.point_prompt: |
| 971 | return |
| 972 | if dpg.is_item_focused('_control_window'): |
| 973 | return |
| 974 | pos = dpg.get_mouse_pos() |
| 975 | if pos[0] > self.W or pos[1] > self.H: |
| 976 | return |
| 977 | print(pos, self.means2d.max(dim=0)[0]) |
| 978 | # find pos in means2D, distance < 5 pixels |
| 979 | # mask = self.means2d == torch.tensor(pos, device=self.device) |
| 980 | pos = torch.tensor([pos[0], pos[1]+16], device=self.device) |
| 981 | mask = torch.sum((self.means2d - pos)**2, dim=1) < 3 |
| 982 | wmask = self.gweight > 0.005 |
| 983 | self.point_mask = self.point_mask | (mask & wmask) |
| 984 | print(mask.sum()) |
| 985 | if mask.sum() == 0: |
| 986 | # print("no point found") |
| 987 | return |
| 988 | self.set_mask_rendering(self.point_mask) |
| 989 | self.need_update = True |
| 990 | |
| 991 | def callback_camera_drag_rotate_or_draw_mask(sender, app_data): |
| 992 | if not dpg.is_item_focused("_primary_window"): |
nothing calls this directly
no test coverage detected