FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix logic issues and find nearest point · edwardchen123/processing@61f5ead · GitHub

Repository navigation

Commit 61f5ead

Browse files
committed
fix logic issues and find nearest point
1 parent e3c2d2e commit 61f5ead

2 files changed

Lines changed: 42 additions & 33 deletions

File tree

‎core/todo.txt‎

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,6 @@ X https://github.com/processing/processing/issues/3685
66
X setFill() on PShape in Java2D throws ArrayIndexOutOfBoundsException
77
X https://github.com/processing/processing/issues/3677
88

9-
cleaning
10-
X How do images behave when pixelDensity(2) is set?
11-
X https://github.com/processing/processing/issues/3364
12-
X retina sketches slow to start
13-
X https://github.com/processing/processing/issues/2357
14-
X zero alpha values still a problem with retina renderer
15-
X https://github.com/processing/processing/issues/2030
16-
179
jakub
1810
X keyTyped() not firing with P2D and P3D
1911
X https://github.com/processing/processing/issues/3582
@@ -31,6 +23,19 @@ X added note about AIOOBE seen earlier
3123
X Update LowLevelGL to use VBOs
3224
X https://github.com/processing/processing-docs/pull/289
3325

26+
cleaning
27+
X How do images behave when pixelDensity(2) is set?
28+
X https://github.com/processing/processing/issues/3364
29+
X retina sketches slow to start
30+
X https://github.com/processing/processing/issues/2357
31+
X zero alpha values still a problem with retina renderer
32+
X https://github.com/processing/processing/issues/2030
33+
X fullScreen(SPAN) reported not working (cannot reproduce)
34+
X probably need to re-query for displays each time opening prefs
35+
X what happens when a screen is added after p5 has started?
36+
X https://github.com/processing/processing/issues/3381
37+
X fixed in beta 1
38+
3439

3540
known issues
3641
_ P2D and P3D windows behave strangely when larger than the screen size
@@ -128,10 +133,6 @@ _ https://bugs.openjdk.java.net/browse/JDK-8027391
128133
_ test with JG's 13" retina laptop
129134
_ Ubuntu Unity prevents full screen from working properly
130135
_ https://github.com/processing/processing/issues/3158
131-
_ fullScreen(SPAN) reported not working (cannot reproduce)
132-
X probably need to re-query for displays each time opening prefs
133-
X what happens when a screen is added after p5 has started?
134-
_ https://github.com/processing/processing/issues/3381
135136

136137

137138
graphics

‎java/src/processing/mode/java/MarkerColumn.java‎

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -158,17 +158,13 @@ protected void done() {
158158

159159

160160
/** Find out which error/warning the user has clicked and scroll to it */
161-
void scrollToMarkerAt(final int y) {
161+
private void scrollToMarkerAt(final int y) {
162162
try {
163-
new SwingWorker<Object, Object>() {
163+
new SwingWorker() {
164164
protected Object doInBackground() throws Exception {
165-
for (LineMarker m : errorPoints) {
166-
// -2 and +2 are extra allowance, clicks in the
167-
// vicinity of the markers register that way
168-
if (Math.abs(y - m.getY()) < 3) {
169-
editor.getErrorChecker().scrollToErrorLine(m.getProblem());
170-
return null;
171-
}
165+
LineMarker m = findClosestMarker(y);
166+
if (m != null) {
167+
editor.getErrorChecker().scrollToErrorLine(m.getProblem());
172168
}
173169
return null;
174170
}
@@ -180,20 +176,18 @@ protected Object doInBackground() throws Exception {
180176

181177

182178
/** Show tooltip on hover. */
183-
void showMarkerHover(final int y) {
179+
private void showMarkerHover(final int y) {
184180
try {
185-
new SwingWorker<Object, Object>() {
181+
new SwingWorker() {
186182
protected Object doInBackground() throws Exception {
187-
for (LineMarker m : errorPoints) {
188-
if (Math.abs(y - m.getY()) < 3) {
189-
Problem p = m.getProblem();
190-
String kind = p.isError() ?
191-
Language.text("editor.status.error") :
192-
Language.text("editor.status.warning");
193-
setToolTipText(kind + ": " + p.getMessage());
194-
setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
195-
break;
196-
}
183+
LineMarker m = findClosestMarker(y);
184+
if (m != null) {
185+
Problem p = m.getProblem();
186+
String kind = p.isError() ?
187+
Language.text("editor.status.error") :
188+
Language.text("editor.status.warning");
189+
setToolTipText(kind + ": " + p.getMessage());
190+
setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
197191
}
198192
return null;
199193
}
@@ -204,6 +198,20 @@ protected Object doInBackground() throws Exception {
204198
}
205199

206200

201+
private LineMarker findClosestMarker(final int y) {
202+
LineMarker closest = null;
203+
int closestDist = Integer.MAX_VALUE;
204+
for (LineMarker m : errorPoints) {
205+
int dist = Math.abs(y - m.getY());
206+
if (dist < 3 && dist < closestDist) {
207+
closest = m;
208+
closestDist = dist;
209+
}
210+
}
211+
return closest;
212+
}
213+
214+
207215
public Dimension getPreferredSize() {
208216
return new Dimension(WIDE, super.getPreferredSize().height);
209217
}

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL