Skip to content

Commit

Permalink
hide node names and replace labels with "~" if zoomed out too much
Browse files Browse the repository at this point in the history
  • Loading branch information
zamdzhiev committed Oct 13, 2014
1 parent f04eb39 commit c719ad0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
29 changes: 16 additions & 13 deletions scala/src/main/scala/quanto/gui/graphview/GraphView.scala
Original file line number Diff line number Diff line change
Expand Up @@ -315,19 +315,20 @@ class GraphView(val theory: Theory, gRef: HasGraph) extends Panel

g.fill(shape)

/// show the vname on the GUI
val sh = shape.getBounds.getLocation
val px = sh.getX.toInt
val py = sh.getY.toInt

//println(sh)
if (showNames || graph.vdata(v).isBoundary) {
a = g.getColor
g.setFont(EdgeLabelFont)
g.setColor(Color.BLACK)

g.drawString(v.toString, px, py - 5)
g.setColor(a)
/// show the vname on the GUI only if zoomed in enough
if(zoom >= zoomCutOut) {
val sh = shape.getBounds.getLocation
val px = sh.getX.toInt
val py = sh.getY.toInt

if (showNames || graph.vdata(v).isBoundary) {
a = g.getColor
g.setFont(EdgeLabelFont)
g.setColor(Color.BLACK)

g.drawString(v.toString, px, py - 5)
g.setColor(a)
}
}

if (selectedVerts contains v) {
Expand Down Expand Up @@ -664,6 +665,8 @@ object GraphView {
final val VertexLabelFont = new Font("Dialog", AWTFont.PLAIN, 12)
final val EdgeLabelFont = new Font("Dialog", AWTFont.PLAIN, 10)

final val zoomCutOut = 0.36

final val AxisColor = new Color(0.8f,0.8f,0.9f)
final val MajorColor = new Color(0.85f,0.85f,1.0f)
final val MinorColor = new Color(0.9f,0.9f,1.0f)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@ trait VertexDisplayData { self: GraphView =>
vertexDisplay(v) = data match {
case vertexData : NodeV =>
val style = vertexData.typeInfo.style
val text = vertexData.value.stringValue
val text = if(zoom < GraphView.zoomCutOut &&
vertexData.value.stringValue != "")
"~"
else
vertexData.value.stringValue
/*vertexData.typeInfo.value.typ match {
case Theory.ValueType.String => vertexData.value
case _ => ""
Expand Down

0 comments on commit c719ad0

Please sign in to comment.