diff --git a/src/mcedit2/editorsession.py b/src/mcedit2/editorsession.py index 241feb1..31d5f69 100644 --- a/src/mcedit2/editorsession.py +++ b/src/mcedit2/editorsession.py @@ -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) diff --git a/src/mcedit2/editortools/move.py b/src/mcedit2/editortools/move.py index 87c5c5e..75990f6 100644 --- a/src/mcedit2/editortools/move.py +++ b/src/mcedit2/editortools/move.py @@ -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 diff --git a/src/mceditlib/selection/__init__.py b/src/mceditlib/selection/__init__.py index 83f33ec..3e8bc88 100644 --- a/src/mceditlib/selection/__init__.py +++ b/src/mceditlib/selection/__init__.py @@ -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"""