Get SchematicWorldView working again, tweak zoom limits
This commit is contained in:
parent
b8865c8f9e
commit
1c5d244b47
@ -9,11 +9,15 @@ from mcedit2.rendering.textureatlas import TextureAtlas
|
|||||||
from mcedit2.util import minecraftinstall
|
from mcedit2.util import minecraftinstall
|
||||||
from mcedit2.util.screen import centerWidgetInScreen
|
from mcedit2.util.screen import centerWidgetInScreen
|
||||||
from mcedit2.util.worldloader import WorldLoader
|
from mcedit2.util.worldloader import WorldLoader
|
||||||
from mcedit2.worldview.camera import CameraWorldView, CameraPanMouseAction
|
from mcedit2.worldview.camera import CameraWorldView, CameraPanMouseAction, \
|
||||||
|
CameraStickyPanMouseAction
|
||||||
from mcedit2.worldview.viewaction import ViewAction
|
from mcedit2.worldview.viewaction import ViewAction
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
minZoom = 0.1
|
||||||
|
maxZoom = 2.0
|
||||||
|
|
||||||
class SchematicZoomInAction(ViewAction):
|
class SchematicZoomInAction(ViewAction):
|
||||||
labelText = "Zoom Schematic View In"
|
labelText = "Zoom Schematic View In"
|
||||||
button = ViewAction.WHEEL_UP
|
button = ViewAction.WHEEL_UP
|
||||||
@ -21,7 +25,7 @@ class SchematicZoomInAction(ViewAction):
|
|||||||
settingsKey = None
|
settingsKey = None
|
||||||
|
|
||||||
def keyPressEvent(self, event):
|
def keyPressEvent(self, event):
|
||||||
event.view.distance = min(2.0, max(0.5, event.view.distance - 0.05))
|
event.view.distance = min(maxZoom, max(minZoom, event.view.distance - 0.05))
|
||||||
|
|
||||||
class SchematicZoomOutAction(ViewAction):
|
class SchematicZoomOutAction(ViewAction):
|
||||||
labelText = "Zoom Schematic View Out"
|
labelText = "Zoom Schematic View Out"
|
||||||
@ -30,7 +34,8 @@ class SchematicZoomOutAction(ViewAction):
|
|||||||
settingsKey = None
|
settingsKey = None
|
||||||
|
|
||||||
def keyPressEvent(self, event):
|
def keyPressEvent(self, event):
|
||||||
event.view.distance = min(2.0, max(0.5, event.view.distance + 0.05))
|
event.view.distance = min(maxZoom, max(minZoom, event.view.distance + 0.05))
|
||||||
|
|
||||||
|
|
||||||
class SchematicWorldView(CameraWorldView):
|
class SchematicWorldView(CameraWorldView):
|
||||||
def __init__(self, dimension, textureAtlas):
|
def __init__(self, dimension, textureAtlas):
|
||||||
@ -38,8 +43,10 @@ class SchematicWorldView(CameraWorldView):
|
|||||||
|
|
||||||
self.distance = 1.4
|
self.distance = 1.4
|
||||||
self.centerPoint = dimension.bounds.center
|
self.centerPoint = dimension.bounds.center
|
||||||
|
stickyPanAction = CameraStickyPanMouseAction()
|
||||||
|
|
||||||
self.viewActions = [CameraPanMouseAction(),
|
self.viewActions = [CameraPanMouseAction(stickyPanAction),
|
||||||
|
stickyPanAction,
|
||||||
SchematicZoomInAction(),
|
SchematicZoomInAction(),
|
||||||
SchematicZoomOutAction()]
|
SchematicZoomOutAction()]
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user