merged
authorWalther Neuper <wneuper@ist.tugraz.at>
Wed, 02 Aug 2017 09:11:13 +0200
changeset 518940a3d69df537
parent 5187 5f4cc0eadbaa
parent 5188 0006f55fcb23
child 5190 d3fa6cda3137
merged
isac-java/src/java/isac/gui/mawen/editor/EventUtil.scala
     1.1 --- a/isac-java/src/java/isac/gui/mawen/editor/EventUtil.scala	Wed Aug 02 09:09:40 2017 +0200
     1.2 +++ b/isac-java/src/java/isac/gui/mawen/editor/EventUtil.scala	Wed Aug 02 09:11:13 2017 +0200
     1.3 @@ -38,20 +38,21 @@
     1.4  
     1.5    
     1.6    
     1.7 -  
     1.8 -  def doInBox(mousePos: Point, f: (Graphics, DrawBox) => Unit) : (Graphics, DrawBox) => Unit = {
     1.9 -	  
    1.10 +  /*
    1.11 +   * return-value is stored in <code>foreachBoxFunction</code>
    1.12 +   */
    1.13 +  def doInBox(mousePos: Point, f: (Graphics, DrawBox) => Unit) : 
    1.14 +      (Graphics, DrawBox) => Unit = {
    1.15  	  (g: Graphics, box: DrawBox) => {
    1.16 -	      val xfrom = box.x * Settings.zoom + Settings.translateX
    1.17 -  	    val xto   = box.x * Settings.zoom + Settings.translateX + box.width  * Settings.zoom
    1.18 -  	    val yfrom = box.y * Settings.zoom + Settings.translateY - box.height * Settings.zoom
    1.19 -  	    val yto   = box.y * Settings.zoom + Settings.translateY
    1.20 -  	   
    1.21 -  	    if (xfrom < mousePos.x && xto > mousePos.x
    1.22 -  	        && yfrom < mousePos.y && yto > mousePos.y) {
    1.23 -  	        
    1.24 -  	      f(g, box)
    1.25 -  	    }
    1.26 +	    val xfrom = box.x * Settings.zoom + Settings.translateX
    1.27 +  	  val xto   = box.x * Settings.zoom + Settings.translateX 
    1.28 +  	    + box.width  * Settings.zoom
    1.29 +  	  val yfrom = box.y * Settings.zoom + Settings.translateY 
    1.30 +        - box.height * Settings.zoom
    1.31 +  	  val yto   = box.y * Settings.zoom + Settings.translateY
    1.32 +  	  if (xfrom < mousePos.x && xto > mousePos.x && 
    1.33 +  	      yfrom < mousePos.y && yto > mousePos.y)
    1.34 +  	    f(g, box)
    1.35  	  }
    1.36  	}
    1.37