Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich2 committed Aug 11, 2022
1 parent 1610fdb commit 7b5f742
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Tiling/src/prid/phex/HGridSys.scala
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/* Copyright 2018-22 Richard Oliver. Licensed under Apache Licence version 2.0. */
package ostrat; package prid; package phex
import geom._, reflect.ClassTag, Colour.Black
import geom._, reflect.ClassTag, pgui._, Colour.Black

/** System of hex tile grids. Can be a single [[HGrid]] or a system of multiple hex tile grids. */
trait HGridSys extends Any with TGridSys
{
def projection: HSysProjection = HProjectionFlat(this)
def projection: Panel => HSysProjection = HProjectionFlat(this, _)

final override lazy val numTiles: Int =
{ var i = 0
Expand Down
7 changes: 4 additions & 3 deletions Tiling/src/prid/phex/HProjectionFlat.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,25 @@
package ostrat; package prid; package phex
import geom._, pgui._

final case class HProjectionFlat(gridSys: HGridSys) extends HSysProjection
final case class HProjectionFlat(gridSys: HGridSys, panel: Panel) extends HSysProjection
{ type GridT = HGridSys

var cPScale: Double = 10
var focus: Vec2 = Vec2(0, 0)
override def sides: LineSegArr = gridSys.sideLines.slate(-focus).scale(cPScale)
def sidesDraw(lineWidth: Double = 2, colour: Colour = Colour.Black): LinesDraw = sides.draw(lineWidth, colour)

def frame: GraphicElems = ???
def zoomIn: PolygonCompound = clickButton("+") { _ =>
cPScale *= 1.1
//repaint()
panel.repaint(frame)
//statusText = tilePScaleStr
//thisTop()
}

def zoomOut: PolygonCompound = clickButton("-") { _ =>
cPScale /= 1.1
//repaint()
panel.repaint(frame)
//statusText = tilePScaleStr
//thisTop()
}
Expand Down
3 changes: 2 additions & 1 deletion Tiling/src/prid/phex/HSysProjection.scala
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
/* Copyright 2018-22 Richard Oliver. Licensed under Apache Licence version 2.0. */
package ostrat; package prid; package phex
import geom._
import geom._, pgui._

/** Hex grid system projection. */
trait HSysProjection
{ type GridT <: HGridSys
def gridSys: GridT
def sides: LineSegArr
def panel: Panel
}

0 comments on commit 7b5f742

Please sign in to comment.