244b891d7d515e88416723966f755417f55119db
[SugarCubes.git] / _Overlay.pde
1 import java.lang.reflect.*;
2
3 /**
4 * DOUBLE BLACK DIAMOND DOUBLE BLACK DIAMOND
5 *
6 * //\\ //\\ //\\ //\\
7 * ///\\\ ///\\\ ///\\\ ///\\\
8 * \\\/// \\\/// \\\/// \\\///
9 * \\// \\// \\// \\//
10 *
11 * EXPERTS ONLY!! EXPERTS ONLY!!
12 *
13 * Overlay UI that indicates pattern control, etc. This will be moved
14 * into the Processing library once it is stabilized and need not be
15 * regularly modified.
16 */
17 abstract class OverlayUI {
18 protected final PFont titleFont = createFont("Myriad Pro", 10);
19 protected final color titleColor = #AAAAAA;
20 protected final PFont itemFont = createFont("Lucida Grande", 11);
21 protected final PFont knobFont = titleFont;
22 protected final int w = 140;
23 protected final int leftPos;
24 protected final int leftTextPos;
25 protected final int lineHeight = 20;
26 protected final int sectionSpacing = 12;
27 protected final int controlSpacing = 18;
28 protected final int tempoHeight = 20;
29 protected final int knobSize = 28;
30 protected final float knobIndent = .4;
31 protected final int knobSpacing = 6;
32 protected final int knobLabelHeight = 14;
33 protected final color lightBlue = #666699;
34 protected final color lightGreen = #669966;
35
36 private PImage logo;
37
38 protected final int STATE_DEFAULT = 0;
39 protected final int STATE_ACTIVE = 1;
40 protected final int STATE_PENDING = 2;
41
42 protected OverlayUI() {
43 leftPos = width - w;
44 leftTextPos = leftPos + 4;
45 logo = loadImage("logo-sm.png");
46 }
47
48 protected void drawLogoAndBackground() {
49 image(logo, 4, 4);
50 stroke(color(0, 0, 100));
51 // fill(color(0, 0, 50, 50)); // alpha is bad for perf
52 fill(color(0, 0, 30));
53 rect(leftPos-1, -1, w+2, height+2);
54 }
55
56 protected void drawToggleTip(String s) {
57 fill(#999999);
58 textFont(itemFont);
59 textAlign(LEFT);
60 text(s, leftTextPos, height-6);
61 }
62
63 protected void drawHelpTip() {
64 textFont(itemFont);
65 textAlign(RIGHT);
66 text("Tap 'u' to restore UI", width-4, height-6);
67 }
68
69 public void drawFPS() {
70 textFont(titleFont);
71 textAlign(LEFT);
72 fill(#666666);
73 text("FPS: " + (((int)(frameRate * 10)) / 10.), 4, height-6);
74 }
75
76 protected int drawObjectList(int yPos, String title, Object[] items, Method stateMethod) {
77 return drawObjectList(yPos, title, items, classNameArray(items, null), stateMethod);
78 }
79
80 protected int drawObjectList(int yPos, String title, Object[] items, String[] names, Method stateMethod) {
81 noStroke();
82 fill(titleColor);
83 textFont(titleFont);
84 textAlign(LEFT);
85 text(title, leftTextPos, yPos += lineHeight);
86 if (items != null) {
87 textFont(itemFont);
88 color textColor;
89 boolean even = true;
90 for (int i = 0; i < items.length; ++i) {
91 Object o = items[i];
92 int state = STATE_DEFAULT;
93 try {
94 state = ((Integer) stateMethod.invoke(this, o)).intValue();
95 } catch (Exception x) {
96 throw new RuntimeException(x);
97 }
98 switch (state) {
99 case STATE_ACTIVE:
100 fill(lightGreen);
101 textColor = #eeeeee;
102 break;
103 case STATE_PENDING:
104 fill(lightBlue);
105 textColor = color(0, 0, 75 + 15*sin(millis()/200.));;
106 break;
107 default:
108 textColor = 0;
109 fill(even ? #666666 : #777777);
110 break;
111 }
112 rect(leftPos, yPos+6, width, lineHeight);
113 fill(textColor);
114 text(names[i], leftTextPos, yPos += lineHeight);
115 even = !even;
116 }
117 }
118 return yPos;
119 }
120
121 protected String[] classNameArray(Object[] objects, String suffix) {
122 if (objects == null) {
123 return null;
124 }
125 String[] names = new String[objects.length];
126 for (int i = 0; i < objects.length; ++i) {
127 names[i] = className(objects[i], suffix);
128 }
129 return names;
130 }
131
132 protected String className(Object p, String suffix) {
133 String s = p.getClass().getName();
134 int li;
135 if ((li = s.lastIndexOf(".")) > 0) {
136 s = s.substring(li + 1);
137 }
138 if (s.indexOf("SugarCubes$") == 0) {
139 s = s.substring("SugarCubes$".length());
140 }
141 if ((suffix != null) && ((li = s.indexOf(suffix)) != -1)) {
142 s = s.substring(0, li);
143 }
144 return s;
145 }
146
147 protected int objectClickIndex(int firstItemY) {
148 return (mouseY - firstItemY) / lineHeight;
149 }
150
151 abstract public void draw();
152 abstract public void mousePressed();
153 abstract public void mouseDragged();
154 abstract public void mouseReleased();
155 }
156
157 /**
158 * UI for control of patterns, transitions, effects.
159 */
160 class ControlUI extends OverlayUI {
161 private final String[] patternNames;
162 private final String[] transitionNames;
163 private final String[] effectNames;
164
165 private int firstPatternY;
166 private int firstPatternKnobY;
167 private int firstTransitionY;
168 private int firstTransitionKnobY;
169 private int firstEffectY;
170 private int firstEffectKnobY;
171
172 private int tempoY;
173
174 private Method patternStateMethod;
175 private Method transitionStateMethod;
176 private Method effectStateMethod;
177
178 private final int NUM_PATTERN_KNOBS = 8;
179 private final int NUM_TRANSITION_KNOBS = 4;
180 private final int NUM_EFFECT_KNOBS = 4;
181
182 private int activeTransitionIndex = 0;
183 private int activeEffectIndex = 0;
184
185 public final VirtualPatternKnob[] patternKnobs;
186 public final VirtualTransitionKnob[] transitionKnobs;
187 public final VirtualEffectKnob[] effectKnobs;
188
189 ControlUI() {
190 patternNames = classNameArray(patterns, "Pattern");
191 transitionNames = classNameArray(transitions, "Transition");
192 effectNames = classNameArray(effects, "Effect");
193
194 patternKnobs = new VirtualPatternKnob[NUM_PATTERN_KNOBS];
195 for (int i = 0; i < patternKnobs.length; ++i) {
196 patternKnobs[i] = new VirtualPatternKnob(i);
197 }
198
199 transitionKnobs = new VirtualTransitionKnob[NUM_TRANSITION_KNOBS];
200 for (int i = 0; i < transitionKnobs.length; ++i) {
201 transitionKnobs[i] = new VirtualTransitionKnob(i);
202 }
203
204 effectKnobs = new VirtualEffectKnob[NUM_EFFECT_KNOBS];
205 for (int i = 0; i < effectKnobs.length; ++i) {
206 effectKnobs[i] = new VirtualEffectKnob(i);
207 }
208
209 try {
210 patternStateMethod = getClass().getMethod("getState", LXPattern.class);
211 effectStateMethod = getClass().getMethod("getState", LXEffect.class);
212 transitionStateMethod = getClass().getMethod("getState", LXTransition.class);
213 } catch (Exception x) {
214 throw new RuntimeException(x);
215 }
216 }
217
218 public void draw() {
219 drawLogoAndBackground();
220 int yPos = 0;
221 firstPatternY = yPos + lineHeight + 6;
222 yPos = drawObjectList(yPos, "PATTERN", patterns, patternNames, patternStateMethod);
223 yPos += controlSpacing;
224 firstPatternKnobY = yPos;
225 int xPos = leftTextPos;
226 for (int i = 0; i < NUM_PATTERN_KNOBS/2; ++i) {
227 drawKnob(xPos, yPos, knobSize, patternKnobs[i]);
228 drawKnob(xPos, yPos + knobSize + knobSpacing + knobLabelHeight, knobSize, patternKnobs[NUM_PATTERN_KNOBS/2 + i]);
229 xPos += knobSize + knobSpacing;
230 }
231 yPos += 2*(knobSize + knobLabelHeight) + knobSpacing;
232
233 yPos += sectionSpacing;
234 firstTransitionY = yPos + lineHeight + 6;
235 yPos = drawObjectList(yPos, "TRANSITION", transitions, transitionNames, transitionStateMethod);
236 yPos += controlSpacing;
237 firstTransitionKnobY = yPos;
238 xPos = leftTextPos;
239 for (int i = 0; i < transitionKnobs.length; ++i) {
240 drawKnob(xPos, yPos, knobSize, transitionKnobs[i]);
241 xPos += knobSize + knobSpacing;
242 }
243 yPos += knobSize + knobLabelHeight;
244
245 yPos += sectionSpacing;
246 firstEffectY = yPos + lineHeight + 6;
247 yPos = drawObjectList(yPos, "FX", effects, effectNames, effectStateMethod);
248 yPos += controlSpacing;
249 firstEffectKnobY = yPos;
250 xPos = leftTextPos;
251 for (int i = 0; i < effectKnobs.length; ++i) {
252 drawKnob(xPos, yPos, knobSize, effectKnobs[i]);
253 xPos += knobSize + knobSpacing;
254 }
255 yPos += knobSize + knobLabelHeight;
256
257 yPos += sectionSpacing;
258 yPos = drawObjectList(yPos, "TEMPO", null, null, null);
259 yPos += 6;
260 tempoY = yPos;
261 stroke(#111111);
262 fill(tempoDown ? lightGreen : color(0, 0, 35 - 8*lx.tempo.rampf()));
263 rect(leftPos + 4, yPos, w - 8, tempoHeight);
264 fill(0);
265 textAlign(CENTER);
266 text("" + ((int)(lx.tempo.bpmf() * 100) / 100.), leftPos + w/2., yPos + tempoHeight - 6);
267 yPos += tempoHeight;
268
269 drawToggleTip("Tap 'u' to hide");
270 }
271
272 public LXParameter getOrNull(List<LXParameter> items, int index) {
273 if (index < items.size()) {
274 return items.get(index);
275 }
276 return null;
277 }
278
279 public int getState(LXPattern p) {
280 if (p == lx.getPattern()) {
281 return STATE_ACTIVE;
282 } else if (p == lx.getNextPattern()) {
283 return STATE_PENDING;
284 }
285 return STATE_DEFAULT;
286 }
287
288 public int getState(LXEffect e) {
289 if (e.isEnabled()) {
290 return STATE_PENDING;
291 } else if (effects[activeEffectIndex] == e) {
292 return STATE_ACTIVE;
293 }
294 return STATE_DEFAULT;
295 }
296
297 public int getState(LXTransition t) {
298 if (t == lx.getTransition()) {
299 return STATE_PENDING;
300 } else if (t == transitions[activeTransitionIndex]) {
301 return STATE_ACTIVE;
302 }
303 return STATE_DEFAULT;
304 }
305
306 private void drawKnob(int xPos, int yPos, int knobSize, LXParameter knob) {
307 final float knobValue = knob.getValuef();
308 String knobLabel = knob.getLabel();
309 if (knobLabel == null) {
310 knobLabel = "-";
311 } else if (knobLabel.length() > 4) {
312 knobLabel = knobLabel.substring(0, 4);
313 }
314
315 ellipseMode(CENTER);
316 noStroke();
317 fill(#222222);
318 // For some reason this arc call really crushes drawing performance. Presumably
319 // because openGL is drawing it and when we overlap the second set of arcs it
320 // does a bunch of depth buffer intersection tests? Ellipse with a trapezoid cut out is faster
321 // arc(xPos + knobSize/2, yPos + knobSize/2, knobSize, knobSize, HALF_PI + knobIndent, HALF_PI + knobIndent + (TWO_PI-2*knobIndent));
322 ellipse(xPos + knobSize/2, yPos + knobSize/2, knobSize, knobSize);
323
324 float endArc = HALF_PI + knobIndent + (TWO_PI-2*knobIndent)*knobValue;
325 fill(lightGreen);
326 arc(xPos + knobSize/2, yPos + knobSize/2, knobSize, knobSize, HALF_PI + knobIndent, endArc);
327
328 // Mask notch out of knob
329 fill(color(0, 0, 30));
330 beginShape();
331 vertex(xPos + knobSize/2, yPos + knobSize/2.);
332 vertex(xPos + knobSize/2 - 6, yPos + knobSize);
333 vertex(xPos + knobSize/2 + 6, yPos + knobSize);
334 endShape();
335
336 // Center circle of knob
337 fill(#333333);
338 ellipse(xPos + knobSize/2, yPos + knobSize/2, knobSize/2, knobSize/2);
339
340 fill(0);
341 rect(xPos, yPos + knobSize + 2, knobSize, knobLabelHeight - 2);
342 fill(#999999);
343 textAlign(CENTER);
344 textFont(knobFont);
345 text(knobLabel, xPos + knobSize/2, yPos + knobSize + knobLabelHeight - 2);
346 }
347
348 class VirtualPatternKnob extends LXVirtualParameter {
349 private final int index;
350
351 VirtualPatternKnob(int index) {
352 this.index = index;
353 }
354
355 public LXParameter getRealParameter() {
356 List<LXParameter> parameters = glucose.getPattern().getParameters();
357 if (index < parameters.size()) {
358 return parameters.get(index);
359 }
360 return null;
361 }
362 }
363
364 class VirtualTransitionKnob extends LXVirtualParameter {
365 private final int index;
366
367 VirtualTransitionKnob(int index) {
368 this.index = index;
369 }
370
371 public LXParameter getRealParameter() {
372 List<LXParameter> parameters = transitions[activeTransitionIndex].getParameters();
373 if (index < parameters.size()) {
374 return parameters.get(index);
375 }
376 return null;
377 }
378 }
379
380 class VirtualEffectKnob extends LXVirtualParameter {
381 private final int index;
382
383 VirtualEffectKnob(int index) {
384 this.index = index;
385 }
386
387 public LXParameter getRealParameter() {
388 List<LXParameter> parameters = effects[activeEffectIndex].getParameters();
389 if (index < parameters.size()) {
390 return parameters.get(index);
391 }
392 return null;
393 }
394 }
395
396 private int patternKnobIndex = -1;
397 private int transitionKnobIndex = -1;
398 private int effectKnobIndex = -1;
399
400 private int lastY;
401 private int releaseEffect = -1;
402 private boolean tempoDown = false;
403
404 public void mousePressed() {
405 lastY = mouseY;
406 patternKnobIndex = transitionKnobIndex = effectKnobIndex = -1;
407 releaseEffect = -1;
408 if (mouseY > tempoY) {
409 if (mouseY - tempoY < tempoHeight) {
410 lx.tempo.tap();
411 tempoDown = true;
412 }
413 } else if ((mouseY >= firstEffectKnobY) && (mouseY < firstEffectKnobY + knobSize + knobLabelHeight)) {
414 effectKnobIndex = (mouseX - leftTextPos) / (knobSize + knobSpacing);
415 } else if (mouseY > firstEffectY) {
416 int effectIndex = objectClickIndex(firstEffectY);
417 if (effectIndex < effects.length) {
418 if (activeEffectIndex == effectIndex) {
419 effects[effectIndex].enable();
420 releaseEffect = effectIndex;
421 }
422 activeEffectIndex = effectIndex;
423 }
424 } else if ((mouseY >= firstTransitionKnobY) && (mouseY < firstTransitionKnobY + knobSize + knobLabelHeight)) {
425 transitionKnobIndex = (mouseX - leftTextPos) / (knobSize + knobSpacing);
426 } else if (mouseY > firstTransitionY) {
427 int transitionIndex = objectClickIndex(firstTransitionY);
428 if (transitionIndex < transitions.length) {
429 activeTransitionIndex = transitionIndex;
430 }
431 } else if ((mouseY >= firstPatternKnobY) && (mouseY < firstPatternKnobY + 2*(knobSize+knobLabelHeight) + knobSpacing)) {
432 patternKnobIndex = (mouseX - leftTextPos) / (knobSize + knobSpacing);
433 if (mouseY >= firstPatternKnobY + knobSize + knobLabelHeight + knobSpacing) {
434 patternKnobIndex += NUM_PATTERN_KNOBS / 2;
435 }
436 } else if (mouseY > firstPatternY) {
437 int patternIndex = objectClickIndex(firstPatternY);
438 if (patternIndex < patterns.length) {
439 patterns[patternIndex].setTransition(transitions[activeTransitionIndex]);
440 lx.goIndex(patternIndex);
441 }
442 }
443 }
444
445 public void mouseDragged() {
446 int dy = lastY - mouseY;
447 lastY = mouseY;
448 if (patternKnobIndex >= 0 && patternKnobIndex < NUM_PATTERN_KNOBS) {
449 LXParameter p = patternKnobs[patternKnobIndex];
450 p.setValue(constrain(p.getValuef() + dy*.01, 0, 1));
451 } else if (effectKnobIndex >= 0 && effectKnobIndex < NUM_EFFECT_KNOBS) {
452 LXParameter p = effectKnobs[effectKnobIndex];
453 p.setValue(constrain(p.getValuef() + dy*.01, 0, 1));
454 } else if (transitionKnobIndex >= 0 && transitionKnobIndex < NUM_TRANSITION_KNOBS) {
455 LXParameter p = transitionKnobs[transitionKnobIndex];
456 p.setValue(constrain(p.getValuef() + dy*.01, 0, 1));
457 }
458 }
459
460 public void mouseReleased() {
461 tempoDown = false;
462 if (releaseEffect >= 0) {
463 effects[releaseEffect].trigger();
464 releaseEffect = -1;
465 }
466 }
467
468 }
469
470 /**
471 * UI for control of mapping.
472 */
473 class MappingUI extends OverlayUI {
474
475 private MappingTool mappingTool;
476
477 private final String MAPPING_MODE_ALL = "All On";
478 private final String MAPPING_MODE_SINGLE_CUBE = "Single Cube";
479 private final String[] mappingModes = {
480 MAPPING_MODE_ALL,
481 MAPPING_MODE_SINGLE_CUBE,
482 };
483 private final Method mappingModeStateMethod;
484
485 private final String CUBE_MODE_ALL = "All Strips";
486 private final String CUBE_MODE_SINGLE_STRIP = "Single Strip";
487 private final String CUBE_MODE_STRIP_PATTERN = "Strip Pattern";
488 private final String[] cubeModes = {
489 CUBE_MODE_ALL,
490 CUBE_MODE_SINGLE_STRIP,
491 CUBE_MODE_STRIP_PATTERN
492 };
493 private final Method cubeModeStateMethod;
494
495 private final String CHANNEL_MODE_RED = "Red";
496 private final String CHANNEL_MODE_GREEN = "Green";
497 private final String CHANNEL_MODE_BLUE = "Blue";
498 private final String[] channelModes = {
499 CHANNEL_MODE_RED,
500 CHANNEL_MODE_GREEN,
501 CHANNEL_MODE_BLUE,
502 };
503 private final Method channelModeStateMethod;
504
505 private int firstMappingY;
506 private int firstCubeY;
507 private int firstChannelY;
508 private int cubeFieldY;
509 private int stripFieldY;
510
511 private boolean dragCube;
512 private boolean dragStrip;
513
514 MappingUI(MappingTool mappingTool) {
515 this.mappingTool = mappingTool;
516 try {
517 mappingModeStateMethod = getClass().getMethod("getMappingState", Object.class);
518 channelModeStateMethod = getClass().getMethod("getChannelState", Object.class);
519 cubeModeStateMethod = getClass().getMethod("getCubeState", Object.class);
520 } catch (Exception x) {
521 throw new RuntimeException(x);
522 }
523 }
524
525 public int getMappingState(Object mappingMode) {
526 boolean active = (mappingMode == MAPPING_MODE_SINGLE_CUBE) == mappingTool.mappingModeSingleCube;
527 return active ? STATE_ACTIVE : STATE_DEFAULT;
528 }
529
530 public int getChannelState(Object channelMode) {
531 boolean active = false;
532 if (channelMode == CHANNEL_MODE_RED) {
533 active = mappingTool.channelModeRed;
534 } else if (channelMode == CHANNEL_MODE_GREEN) {
535 active = mappingTool.channelModeGreen;
536 } else if (channelMode == CHANNEL_MODE_BLUE) {
537 active = mappingTool.channelModeBlue;
538 }
539 return active ? STATE_ACTIVE : STATE_DEFAULT;
540 }
541
542 public int getCubeState(Object cubeMode) {
543 boolean active = false;
544 if (cubeMode == CUBE_MODE_ALL) {
545 active = mappingTool.cubeMode == mappingTool.CUBE_MODE_ALL;
546 } else if (cubeMode == CUBE_MODE_SINGLE_STRIP) {
547 active = mappingTool.cubeMode == mappingTool.CUBE_MODE_SINGLE_STRIP;
548 } else if (cubeMode == CUBE_MODE_STRIP_PATTERN) {
549 active = mappingTool.cubeMode == mappingTool.CUBE_MODE_STRIP_PATTERN;
550 }
551 return active ? STATE_ACTIVE : STATE_DEFAULT;
552 }
553
554 public void draw() {
555 drawLogoAndBackground();
556 int yPos = 0;
557 firstMappingY = yPos + lineHeight + 6;
558 yPos = drawObjectList(yPos, "MAPPING MODE", mappingModes, mappingModes, mappingModeStateMethod);
559 yPos += sectionSpacing;
560
561 firstCubeY = yPos + lineHeight + 6;
562 yPos = drawObjectList(yPos, "CUBE MODE", cubeModes, cubeModes, cubeModeStateMethod);
563 yPos += sectionSpacing;
564
565 firstChannelY = yPos + lineHeight + 6;
566 yPos = drawObjectList(yPos, "CHANNELS", channelModes, channelModes, channelModeStateMethod);
567 yPos += sectionSpacing;
568
569 cubeFieldY = yPos + lineHeight + 6;
570 yPos = drawValueField(yPos, "CUBE ID", glucose.model.getRawIndexForCube(mappingTool.cubeIndex));
571 yPos += sectionSpacing;
572
573 stripFieldY = yPos + lineHeight + 6;
574 yPos = drawValueField(yPos, "STRIP ID", mappingTool.stripIndex + 1);
575
576 drawToggleTip("Tap 'm' to return");
577 }
578
579 private int drawValueField(int yPos, String label, int value) {
580 yPos += lineHeight;
581 textAlign(LEFT);
582 textFont(titleFont);
583 fill(titleColor);
584 text(label, leftTextPos, yPos);
585 fill(0);
586 yPos += 6;
587 rect(leftTextPos, yPos, w-8, lineHeight);
588 yPos += lineHeight;
589
590 fill(#999999);
591 textAlign(CENTER);
592 textFont(itemFont);
593 text("" + value, leftTextPos + (w-8)/2, yPos - 5);
594
595 return yPos;
596 }
597
598 private int lastY;
599
600 public void mousePressed() {
601 dragCube = dragStrip = false;
602 lastY = mouseY;
603 if (mouseY >= stripFieldY) {
604 if (mouseY < stripFieldY + lineHeight) {
605 dragStrip = true;
606 }
607 } else if (mouseY >= cubeFieldY) {
608 if (mouseY < cubeFieldY + lineHeight) {
609 dragCube = true;
610 }
611 } else if (mouseY >= firstChannelY) {
612 int index = objectClickIndex(firstChannelY);
613 switch (index) {
614 case 0: mappingTool.channelModeRed = !mappingTool.channelModeRed; break;
615 case 1: mappingTool.channelModeGreen = !mappingTool.channelModeGreen; break;
616 case 2: mappingTool.channelModeBlue = !mappingTool.channelModeBlue; break;
617 }
618 } else if (mouseY >= firstCubeY) {
619 int index = objectClickIndex(firstCubeY);
620 switch (index) {
621 case 0: mappingTool.cubeMode = mappingTool.CUBE_MODE_ALL; break;
622 case 1: mappingTool.cubeMode = mappingTool.CUBE_MODE_SINGLE_STRIP; break;
623 case 2: mappingTool.cubeMode = mappingTool.CUBE_MODE_STRIP_PATTERN; break;
624 }
625 } else if (mouseY >= firstMappingY) {
626 int index = objectClickIndex(firstMappingY);
627 if (index < 2) {
628 mappingTool.mappingModeSingleCube = (index > 0);
629 }
630 }
631 }
632
633 public void mouseReleased() {
634 }
635
636 public void mouseDragged() {
637 final int DRAG_THRESHOLD = 5;
638 int dy = lastY - mouseY;
639 if (abs(dy) >= DRAG_THRESHOLD) {
640 lastY = mouseY;
641 if (dragCube) {
642 if (dy < 0) {
643 mappingTool.decCube();
644 } else {
645 mappingTool.incCube();
646 }
647 } else if (dragStrip) {
648 if (dy < 0) {
649 mappingTool.decStrip();
650 } else {
651 mappingTool.incStrip();
652 }
653 }
654 }
655
656 }
657
658
659 }
660
661 void mousePressed() {
662 if (mouseX > ui.leftPos) {
663 ui.mousePressed();
664 }
665 }
666
667 void mouseReleased() {
668 if (mouseX > ui.leftPos) {
669 ui.mouseReleased();
670 }
671 }
672
673 void mouseDragged() {
674 if (mouseX > ui.leftPos) {
675 ui.mouseDragged();
676 }
677 }
678