Skip to content

Commit

Permalink
#194 Added scroll zoom to projections.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich2 committed Feb 3, 2023
1 parent 5cb6dfc commit 5364348
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Geom/srcGui/CanvasPanelled.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright 2018-21 Richard Oliver. Licensed under Apache Licence version 2.0. */
/* Copyright 2018-23 Richard Oliver. Licensed under Apache Licence version 2.0. */
package ostrat; package pgui
import geom._

Expand Down
2 changes: 1 addition & 1 deletion Geom/srcGui/CanvasPlatform.scala
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ trait CanvasPlatform extends RectCenlign
var mouseDragged: (Pt2, MouseButton) => Unit = (v, b) => {}
var keyDown: (String) => Unit = (s) => {}
var keyUp: (String) => Unit = (s) => {}
var onScroll: Boolean => Unit = b => {}
var onScroll: Boolean => Unit = { b => }
var resize: () => Unit = () => {}
def clip(pts: Polygon): Unit

Expand Down
1 change: 1 addition & 0 deletions Geom/srcGui/CmdBarGui.scala
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ abstract class CmdBarGui(title: String) extends CanvasPanelled(title)
topBar.repaint(a +% st)
}

canv.onScroll = b => mainPanel.onScroll(b)
def mainMouseUp: (MouseButton, AnyArr, Pt2) => Unit = mainPanel.mouseUp
def mainMouseUp_= (f: (MouseButton, AnyArr, Pt2) => Unit): Unit = { mainPanel.mouseUp = f }
var selected: AnyArr = AnyArr()
Expand Down
2 changes: 1 addition & 1 deletion Geom/srcGui/Panel.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ case class Panel(private val outerCanv: CanvasPanelled, clipPoly: Polygon, cover
val clipVec: Vec2 = clipPoly.cenVec
def width = clipPoly.boundingWidth
def height = clipPoly.boundingHeight

var onScroll: Boolean => Unit = { b => }
def repaint(elems: RArr[GraphicElem]): Unit = { canvObjs = elems; outerCanv.refreshPanel(this) }
def repaints(elems: GraphicElem*): Unit = repaint(elems.toArr)
}
Expand Down
8 changes: 8 additions & 0 deletions Tiling/src/prid/TSysProjection.scala
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ trait TSysProjection
setStatusText(pixTileScaleStr)
}

panel.onScroll = { b =>
pixelsPerC = ife(b, pixelsPerC * 1.1, pixelsPerC / 1.1)
setGChild
panel.repaint(getFrame())
setStatusText(pixTileScaleStr)
}


val buttons: RArr[PolygonCompound]

/** Projected [[Polygon]]s of the tiles. */
Expand Down

0 comments on commit 5364348

Please sign in to comment.