File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -525,6 +525,18 @@ def undo_view(self):
525525 self ._undo_view .setWindowTitle ('Undo History' )
526526 return self ._undo_view
527527
528+ def cursor_pos (self ):
529+ """
530+ Returns the cursor last position in the node graph.
531+
532+ Returns:
533+ tuple(float, float): cursor x,y coordinates of the scene.
534+ """
535+ cursor_pos = self .viewer ().scene_cursor_pos ()
536+ if not cursor_pos :
537+ return 0.0 , 0.0
538+ return cursor_pos .x (), cursor_pos .y ()
539+
528540 def toggle_node_search (self ):
529541 """
530542 toggle the node search widget visibility.
Original file line number Diff line number Diff line change @@ -1573,6 +1573,15 @@ def scene_center(self):
15731573 cent = self ._scene_range .center ()
15741574 return [cent .x (), cent .y ()]
15751575
1576+ def scene_cursor_pos (self ):
1577+ """
1578+ Returns the cursor last position mapped to the scene.
1579+
1580+ Returns:
1581+ QtCore.QPoint: cursor position.
1582+ """
1583+ return self .mapToScene (self ._previous_pos )
1584+
15761585 def nodes_rect_center (self , nodes ):
15771586 """
15781587 Get the center x,y pos from the specified nodes.
You can’t perform that action at this time.
0 commit comments