From a03fd5184792617ecd93c567d141bbc24a9867ef Mon Sep 17 00:00:00 2001 From: Rich2 Date: Fri, 12 Aug 2022 13:54:11 +0100 Subject: [PATCH] #194 Outer hex sides now working through projection. --- Tiling/ExsSrc/gOne/GOneGui.scala | 7 +++++-- Tiling/src/prid/phex/HProjectionFlat.scala | 9 +++++++++ Tiling/src/prid/phex/HSysProjection.scala | 1 + 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Tiling/ExsSrc/gOne/GOneGui.scala b/Tiling/ExsSrc/gOne/GOneGui.scala index 5d0119b70..544ee9c9c 100644 --- a/Tiling/ExsSrc/gOne/GOneGui.scala +++ b/Tiling/ExsSrc/gOne/GOneGui.scala @@ -12,6 +12,8 @@ case class GOneGui(canv: CanvasPlatform, scenStart: OneScen, viewIn: HGView) ext def players: HCenOptDGrid[Player] = scen.oPlayers cPScale = viewIn.pxScale focus = viewIn.vec + val proj = gridSys.projection(mainPanel) + proj.setView(viewIn) /** There are no moves set. The Gui is reset to this state at the start of every turn. */ def NoMoves: HCenOptDGrid[HDirn] = gridSys.newHCenOptDGrid[HDirn] @@ -41,7 +43,8 @@ case class GOneGui(canv: CanvasPlatform, scenStart: OneScen, viewIn: HGView) ext def innerSidesDraw: LinesDraw = gridSys.innerSidesDraw() /** Draws the tiles sides (or edges). */ - def outerSidesDraw: LinesDraw = gridSys.outerSidesDraw(Colour.Gold) + def outerSidesDraw: LinesDraw = proj.outerSidesDraw(2, Colour.Gold) + //gridSys.outerSidesDraw(Colour.Gold).slate(-focus).scale(cPScale) /** This is the graphical display of the planned move orders. */ def moveGraphics: Arr[LineSegDraw] = moves.hcSomesMap { (hc, step) => @@ -78,6 +81,6 @@ case class GOneGui(canv: CanvasPlatform, scenStart: OneScen, viewIn: HGView) ext thisTop() def moveGraphics2: GraphicElems = moveGraphics.slate(-focus).scale(cPScale).flatMap(_.arrow) - def frame: GraphicElems = (tiles +% outerSidesDraw +% innerSidesDraw ++ units ++ hexStrs).slate(-focus).scale(cPScale) ++ moveGraphics2 + def frame: GraphicElems = (tiles +% innerSidesDraw ++ units ++ hexStrs).slate(-focus).scale(cPScale) +% outerSidesDraw ++ moveGraphics2 repaint() } \ No newline at end of file diff --git a/Tiling/src/prid/phex/HProjectionFlat.scala b/Tiling/src/prid/phex/HProjectionFlat.scala index a028db9fd..358a5e238 100644 --- a/Tiling/src/prid/phex/HProjectionFlat.scala +++ b/Tiling/src/prid/phex/HProjectionFlat.scala @@ -11,6 +11,15 @@ final case class HProjectionFlat(gridSys: HGridSys, panel: Panel) extends HSysPr override def innerSides: LineSegArr = gridSys.innerSideLines.slate(-focus).scale(cPScale) override def outerSides: LineSegArr = gridSys.outerSideLines.slate(-focus).scale(cPScale) + override def setView(view: Any): Unit = view match + { + case hv: HGView => { + cPScale = hv.pxScale + focus = hv.vec + } + case d: Double => cPScale = d + case _ => + } def frame: GraphicElems = ??? def zoomIn: PolygonCompound = clickButton("+") { _ => diff --git a/Tiling/src/prid/phex/HSysProjection.scala b/Tiling/src/prid/phex/HSysProjection.scala index 331cda1d6..52d419a9e 100644 --- a/Tiling/src/prid/phex/HSysProjection.scala +++ b/Tiling/src/prid/phex/HSysProjection.scala @@ -13,4 +13,5 @@ trait HSysProjection def innerSidesDraw(lineWidth: Double = 2, colour: Colour = Colour.Black): LinesDraw = innerSides.draw(lineWidth, colour) def outerSidesDraw(lineWidth: Double = 2, colour: Colour = Colour.Black): LinesDraw = outerSides.draw(lineWidth, colour) def panel: Panel + def setView(view: Any): Unit = {} } \ No newline at end of file