Double clicking a pending import zooms to its center
This commit is contained in:
parent
1878917b12
commit
93bd771575
@ -48,6 +48,10 @@ class PendingImport(object):
|
||||
def __repr__(self):
|
||||
return "%s(%r, %r)" % (self.__class__.__name__, self.schematic, self.pos)
|
||||
|
||||
@property
|
||||
def bounds(self):
|
||||
return BoundingBox(self.pos, self.schematic.getDimension().bounds.size)
|
||||
|
||||
class PasteImportCommand(QtGui.QUndoCommand):
|
||||
def __init__(self, editorSession, pendingImport, text, *args, **kwargs):
|
||||
super(PasteImportCommand, self).__init__(*args, **kwargs)
|
||||
|
@ -253,7 +253,7 @@ class MoveTool(EditorTool):
|
||||
def listDoubleClicked(self, index):
|
||||
item = self.importsListModel.itemFromIndex(index)
|
||||
pendingImport = item.data(Qt.UserRole)
|
||||
self.editorSession.editorTab.currentView().centerOnPoint(pendingImport.pos)
|
||||
self.editorSession.editorTab.currentView().centerOnPoint(pendingImport.bounds.center)
|
||||
|
||||
_currentImport = None
|
||||
|
||||
|
@ -386,6 +386,10 @@ class BoundingBox(SelectionBox):
|
||||
"""
|
||||
return self._size
|
||||
|
||||
@property
|
||||
def center(self):
|
||||
return self.origin + self.size * 0.5
|
||||
|
||||
@property
|
||||
def width(self):
|
||||
"""The dimension along the X axis"""
|
||||
|
Reference in New Issue
Block a user