Skip to content

Commit e314c40

Browse files
committed
Use GL view that doesn't break with Grammarly on Mac
1 parent db44dbc commit e314c40

3 files changed

Lines changed: 9 additions & 15 deletions

File tree

src/main/scala/view/MouseableGLWindow.scala

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import java.awt.event.{ MouseAdapter, MouseEvent, MouseWheelEvent }
44
import java.nio.{ FloatBuffer, IntBuffer }
55

66
import com.jogamp.opengl.{ GL, GL2, GL2ES1, GLAutoDrawable, GLEventListener }
7-
import com.jogamp.opengl.awt.GLCanvas
7+
import com.jogamp.opengl.awt.GLJPanel
88
import com.jogamp.opengl.fixedfunc.{ GLLightingFunc, GLMatrixFunc }
99
import com.jogamp.opengl.glu.GLU
1010

@@ -19,12 +19,6 @@ import scala.collection.mutable.Map
1919
import view25d.view.gl.NetLogoGLU
2020

2121
abstract class MouseableGLWindow(viewer: VarviewWindow) extends MouseAdapter with GLEventListener {
22-
private val uiScale = if (System.getProperty("os.name").toLowerCase.contains("linux")) {
23-
Utils.getUIScale
24-
} else {
25-
1
26-
}
27-
2822
// initial values are overwritten immediately - this is the correct initial value for the default model
2923
val observer = new Observer(0, 0, 49.5)
3024

@@ -52,14 +46,14 @@ abstract class MouseableGLWindow(viewer: VarviewWindow) extends MouseAdapter wit
5246
def getObserverDistance: Double =
5347
observer.dist
5448

55-
protected var canvas: GLCanvas = null
49+
protected var canvas: GLJPanel = null
5650

5751
protected var oldx = 0
5852
protected var oldy = 0
5953

6054
var dragging = false
6155

62-
def setCanvas(glCanvas: GLCanvas): Unit = {
56+
def setCanvas(glCanvas: GLJPanel): Unit = {
6357
canvas = glCanvas
6458
}
6559

@@ -321,8 +315,8 @@ abstract class MouseableGLWindow(viewer: VarviewWindow) extends MouseAdapter wit
321315

322316
// required by Interface GLEventListener
323317
override def reshape(drawable: GLAutoDrawable, x: Int, y: Int, width: Int, height: Int): Unit = {
324-
viewer.viewWidth = (width * uiScale).toInt
325-
viewer.viewHeight = (height * uiScale).toInt
318+
viewer.viewWidth = width.toInt
319+
viewer.viewHeight = height.toInt
326320

327321
mainViewport(drawable.getGL.asInstanceOf[GL2], glu)
328322
}

src/main/scala/view/PatchView.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package view25d.view
22

33
import com.jogamp.opengl.{ GLCapabilities, GLProfile }
4-
import com.jogamp.opengl.awt.GLCanvas
4+
import com.jogamp.opengl.awt.GLJPanel
55

66
import java.awt.{ BorderLayout, Dimension }
77
import java.awt.event.{ WindowAdapter, WindowEvent }
@@ -56,7 +56,7 @@ class PatchViewGUI(title: String, reporter: AnonymousReporter) extends VarviewWi
5656
}
5757
})
5858

59-
val glCanvas = new GLCanvas(new GLCapabilities(GLProfile.get(GLProfile.GL2)))
59+
val glCanvas = new GLJPanel(new GLCapabilities(GLProfile.get(GLProfile.GL2)))
6060

6161
glCanvas.addGLEventListener(glManager);
6262
glCanvas.addMouseListener(glManager);

src/main/scala/view/TurtleView.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package view25d.view
22

33
import com.jogamp.opengl.{ GLCapabilities, GLProfile }
4-
import com.jogamp.opengl.awt.GLCanvas
4+
import com.jogamp.opengl.awt.GLJPanel
55

66
import java.awt.{ BorderLayout, Color, Dimension }
77
import java.awt.event.{ WindowAdapter, WindowEvent }
@@ -72,7 +72,7 @@ class TurtleViewGUI(title: String, override protected val initialAgents: AgentSe
7272
}
7373
})
7474

75-
private val glCanvas = new GLCanvas(new GLCapabilities(GLProfile.get(GLProfile.GL2)))
75+
private val glCanvas = new GLJPanel(new GLCapabilities(GLProfile.get(GLProfile.GL2)))
7676

7777
glCanvas.addGLEventListener(glManager)
7878
glCanvas.addMouseListener(glManager)

0 commit comments

Comments
 (0)