propane 0.5.0-java → 0.6.0-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/CHANGELOG.md +3 -1
  4. data/README.md +1 -1
  5. data/Rakefile +1 -1
  6. data/examples/complete/bw_shader.rb +46 -0
  7. data/examples/complete/data/bwfrag.glsl +23 -0
  8. data/examples/complete/data/lachoy.jpg +0 -0
  9. data/examples/complete/data/landscape.glsl +352 -0
  10. data/examples/complete/data/monjori.glsl +30 -0
  11. data/examples/complete/data/moon.jpg +0 -0
  12. data/examples/complete/data/sea.jpg +0 -0
  13. data/examples/complete/edge_detection.rb +49 -0
  14. data/examples/complete/landscape.rb +32 -0
  15. data/examples/complete/linear_image.rb +51 -0
  16. data/examples/complete/monjori.rb +33 -0
  17. data/examples/regular/arcball_box.rb +3 -1
  18. data/examples/regular/arcball_constrain.rb +38 -0
  19. data/examples/regular/bezier_playground.rb +205 -0
  20. data/examples/regular/colors_two.rb +61 -0
  21. data/examples/regular/creating_colors.rb +10 -3
  22. data/examples/regular/elegant_ball.rb +1 -1
  23. data/examples/regular/fibonacci_sphere.rb +90 -0
  24. data/examples/regular/grapher.rb +39 -0
  25. data/examples/regular/gravity.rb +120 -0
  26. data/examples/regular/slider_demo.rb +60 -0
  27. data/examples/regular/slider_example.rb +53 -0
  28. data/examples/regular/slider_simple.rb +47 -0
  29. data/examples/regular/tree.rb +76 -0
  30. data/lib/propane/app.rb +1 -6
  31. data/lib/propane/helper_methods.rb +39 -10
  32. data/lib/propane/version.rb +1 -1
  33. data/library/slider/slider.rb +43 -0
  34. data/pom.rb +4 -4
  35. data/pom.xml +4 -4
  36. data/propane.gemspec +1 -1
  37. data/src/monkstone/ColorUtil.java +42 -9
  38. data/src/monkstone/slider/CustomHorizontalSlider.java +164 -0
  39. data/src/monkstone/slider/CustomVerticalSlider.java +178 -0
  40. data/src/monkstone/slider/SimpleHorizontalSlider.java +145 -0
  41. data/src/monkstone/slider/SimpleSlider.java +175 -0
  42. data/src/monkstone/slider/SimpleVerticalSlider.java +159 -0
  43. data/src/monkstone/slider/Slider.java +61 -0
  44. data/src/monkstone/slider/SliderBar.java +245 -0
  45. data/src/monkstone/slider/SliderGroup.java +56 -0
  46. data/src/monkstone/slider/WheelHandler.java +35 -0
  47. data/src/monkstone/vecmath/vec2/Vec2.java +3 -8
  48. data/src/monkstone/vecmath/vec3/Vec3.java +8 -13
  49. data/vendors/Rakefile +2 -2
  50. metadata +36 -6
  51. data/VERSION.txt +0 -4
@@ -0,0 +1,47 @@
1
+ # encoding: utf-8
2
+ # frozen_string_literal: true
3
+ require 'propane'
4
+
5
+ class SliderSimple < Propane::App
6
+ load_library :slider
7
+ attr_reader :color1, :color2, :color3, :r, :gs, :b, :back
8
+
9
+ def setup
10
+ size(600, 400)
11
+ smooth(4)
12
+ @back = true
13
+ @r, @gs, @b = 0, 0, 0
14
+ @color1 = Slider.slider(
15
+ app: self,
16
+ x: 77,
17
+ y: 200,
18
+ name: 'Slider 1',
19
+ initial_value: 50
20
+ )
21
+ @color2 = Slider.slider(
22
+ app: self,
23
+ x: 77,
24
+ y: 230,
25
+ name: 'Slider 2',
26
+ initial_value: 50
27
+ )
28
+ @color3 = Slider.slider(
29
+ app: self,
30
+ x: 77,
31
+ y: 260,
32
+ name: 'Slider 3'
33
+ )
34
+ color_mode(RGB, 100)
35
+ end
36
+
37
+ def draw
38
+ background(b, r, gs)
39
+ fill(r, gs, b)
40
+ ellipse(300, 200, 300, 300)
41
+ @r = color1.read_value
42
+ @gs = color2.read_value
43
+ @b = color3.read_value
44
+ end
45
+ end
46
+
47
+ SliderSimple.new(title: 'Simple Slider')
@@ -0,0 +1,76 @@
1
+ require 'propane'
2
+
3
+ class Tree < Propane::App
4
+ # http://processing.org/learning/topics/tree.html
5
+ # by Joe Holt
6
+
7
+ def setup
8
+ size 200, 200
9
+ color_mode RGB, 1
10
+ frame_rate 30
11
+ smooth
12
+ @x = 0.0
13
+ @dx = width / 100
14
+ @start_time = Time.now
15
+ @frame_time = nil
16
+ end
17
+
18
+ def draw
19
+ t = Time.now
20
+ if @frame_time
21
+ fps = 1.0 / (t - @frame_time)
22
+ # printf "%0.1f fps\n", fps
23
+ end
24
+ @frame_time = t
25
+
26
+ background 0
27
+ stroke 1, 1, 1
28
+ # Let's pick an angle 0 to 90 degrees based on the mouse position
29
+ a = (@x / width) * 90
30
+ # Convert it to radians
31
+ @theta = a.radians
32
+ # Start the tree from the bottom of the screen
33
+ translate(width / 2, height)
34
+ # Draw a line 60 pixels
35
+ h = height / 3
36
+ line(0, 0, 0, -h)
37
+ # Move to the end of that line
38
+ translate(0, -h)
39
+ # Start the recursive branching!
40
+ branch(h)
41
+
42
+ @x += @dx
43
+ if @x < 0
44
+ puts "Time after this iteration: " + (Time.now - @start_time).to_s
45
+ end
46
+ if @x > width || @x < 0
47
+ @dx = - @dx
48
+ @x += @dx * 2
49
+ end
50
+ end
51
+
52
+ def branch(h)
53
+ # Each branch will be 2/3rds the size of the previous one
54
+ h *= 0.66
55
+ # All recursive functions must have an exit condition!!!!
56
+ # Here, ours is when the length of the branch is 2 pixels or less
57
+ if h > 2
58
+ push_matrix # Save the current state of transformation (i.e. where are we now)
59
+ rotate(@theta) # Rotate by theta
60
+ line(0, 0, 0, -h) # Draw the branch
61
+ translate(0, -h) # Move to the end of the branch
62
+ branch(h) # Ok, now call myself to draw two new branches!!
63
+ pop_matrix # Whenever we get back here, we "pop" in order to restore the previous matrix state
64
+
65
+ # Repeat the same thing, only branch off to the "left" this time!
66
+ push_matrix
67
+ rotate(-@theta)
68
+ line(0, 0, 0, -h)
69
+ translate(0, -h)
70
+ branch(h)
71
+ pop_matrix
72
+ end
73
+ end
74
+ end
75
+
76
+ Tree.new title: 'Tree'
data/lib/propane/app.rb CHANGED
@@ -111,12 +111,7 @@ module Propane
111
111
  int < 256 ? int.chr : int
112
112
  end
113
113
 
114
- private
115
-
116
- # Provide a convenient handle for the Java-space version of self.
117
- def java_self
118
- @java_self ||= to_java(Java::ProcessingCore::PApplet)
119
- end
114
+ private
120
115
 
121
116
  def import_opengl
122
117
  # Include processing opengl classes that we'd like to use:
@@ -15,6 +15,21 @@ module Propane
15
15
  buf
16
16
  end
17
17
 
18
+ def kamera(
19
+ eye: Vec3D.new(width / 2.0, height / 2.0, (height / 2.0) / tan(PI * 30.0 / 180.0)),
20
+ center: Vec3D.new(width / 2.0, height / 2.0, 0),
21
+ up: Vec3D.new(0, 1.0, 0))
22
+ camera(eye.x, eye.y, eye.z, center.x, center.y, center.z, up.x, up.y, up.z)
23
+ end
24
+
25
+ def perspektiv(
26
+ fov: Math::PI / 3.0,
27
+ aspect_ratio: width.to_f / height,
28
+ near_z: (height / 20.0) / tan(fov / 2.0),
29
+ far_z: (height * 5) / tan(fov / 2.0))
30
+ perspective(fov, aspect_ratio, near_z, far_z)
31
+ end
32
+
18
33
  # A nice method to run a given block for a grid.
19
34
  # Lifted from action_coding/Nodebox.
20
35
  def grid(cols, rows, col_size = 1, row_size = 1)
@@ -36,6 +51,15 @@ module Propane
36
51
  super(hex_color(args[0]))
37
52
  end
38
53
 
54
+ def web_to_color_array(web)
55
+ Java::Monkstone::ColorUtil.webArray(web)
56
+ end
57
+
58
+ def int_to_ruby_colors(hex)
59
+ Java::Monkstone::ColorUtil.rubyString(hex)
60
+ end
61
+
62
+
39
63
  # Overrides Processing convenience function thread, which takes a String
40
64
  # arg (for a function) to more rubylike version, takes a block...
41
65
  def thread(&block)
@@ -102,12 +126,10 @@ module Propane
102
126
  end
103
127
  end
104
128
 
105
-
106
-
107
129
  # Provide a convenient handle for the Java-space version of self.
108
- #def java_self
109
- # @java_self ||= to_java(Java::ProcessingCore::PApplet)
110
- #end
130
+ def java_self
131
+ @java_self ||= to_java(Java::ProcessingCore::PApplet)
132
+ end
111
133
 
112
134
  # Get the sketch path
113
135
  def sketch_path
@@ -146,17 +168,24 @@ module Propane
146
168
  super(fps)
147
169
  end
148
170
 
149
-
150
171
  private
151
172
 
173
+ FIXNUM_COL = -> (x) { x.is_a?(Fixnum) }
174
+ STRING_COL = -> (x) { x.is_a?(String) }
175
+ FLOAT_COL = -> (x) { x.is_a?(Float) }
152
176
  # parse single argument color int/double/String
153
177
  def hex_color(a)
154
- return Java::Monkstone::ColorUtil.colorLong(a) if a.is_a?(Fixnum)
155
- if a.is_a?(String)
178
+ case a
179
+ when FIXNUM_COL
180
+ Java::Monkstone::ColorUtil.colorLong(a)
181
+ when STRING_COL
156
182
  return Java::Monkstone::ColorUtil.colorString(a) if a =~ /#\h+/
157
- raise StandardError, 'Dodgy Hexstring'
183
+ fail StandardError, 'Dodgy Hexstring'
184
+ when FLOAT_COL
185
+ Java::Monkstone::ColorUtil.colorDouble(a)
186
+ else
187
+ fail StandardError, 'Dodgy Color Conversion'
158
188
  end
159
- Java::Monkstone::ColorUtil.colorDouble(a)
160
189
  end
161
190
 
162
191
  def dist2d(*args)
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
  # frozen_string_literal: true
3
3
  module Propane
4
- VERSION = '0.5.0'.freeze
4
+ VERSION = '0.6.0'.freeze
5
5
  end
@@ -0,0 +1,43 @@
1
+ # encoding: utf-8
2
+ # frozen_string_literal: true
3
+ # Here's a little library for quickly hooking up in sketch sliders.
4
+ # Copyright (c) 2016 Martin Prout.
5
+
6
+ java_import 'monkstone.slider.CustomHorizontalSlider'
7
+ java_import 'monkstone.slider.CustomVerticalSlider'
8
+
9
+ module Slider
10
+ def self.slider(app:, x:, y:, name:, **opts)
11
+ options = default.merge opts
12
+ if options[:vertical]
13
+ slider = CustomVerticalSlider.new(
14
+ app,
15
+ x,
16
+ y,
17
+ options[:length],
18
+ options[:range].first,
19
+ options[:range].last,
20
+ name
21
+ )
22
+ else
23
+ slider = CustomHorizontalSlider.new(
24
+ app,
25
+ x,
26
+ y,
27
+ options[:length],
28
+ options[:range].first,
29
+ options[:range].last,
30
+ name
31
+ )
32
+ end
33
+ unless opts.empty?
34
+ slider.bar_width(opts.fetch(:bar_width, 10))
35
+ slider.set_value(opts.fetch(:initial_value, 0))
36
+ end
37
+ slider
38
+ end
39
+
40
+ def self.default
41
+ { length: 100, range: (0..100) }
42
+ end
43
+ end
data/pom.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'fileutils'
2
2
  project 'rp5extras', 'https://github.com/monkstone/propane' do
3
3
  model_version '4.0.0'
4
- id 'propane:rp5extras', '0.5.0'
4
+ id 'propane:rp5extras', '0.6.0'
5
5
  packaging 'jar'
6
6
  description 'rp5extras for propane'
7
7
  organization 'ruby-processing', 'https://ruby-processing.github.io'
@@ -24,16 +24,16 @@ project 'rp5extras', 'https://github.com/monkstone/propane' do
24
24
  properties('source.directory' => 'src',
25
25
  'propane.basedir' => '${project.basedir}',
26
26
  'polyglot.dump.pom' => 'pom.xml',
27
- 'maven.compiler.source' => '1.7',
27
+ 'maven.compiler.source' => '1.8',
28
28
  'project.build.sourceEncoding' => 'utf-8',
29
- 'maven.compiler.target' => '1.7',
29
+ 'maven.compiler.target' => '1.8',
30
30
  'jruby.api' => 'http://jruby.org/apidocs/',
31
31
  'processing.api' => 'http://processing.github.io/processing-javadocs/core/',
32
32
  'jruby.api' => 'http://jruby.org/apidocs/',
33
33
  'jogl.version' => '2.1.5-01'
34
34
  )
35
35
 
36
- pom('org.jruby:jruby:9.0.5.0')
36
+ pom('org.jruby:jruby:9.1.0.0')
37
37
  jar('org.processing:core:2.2.1')
38
38
  jar('org.jogamp.jogl:jogl-all:${jogl.version}')
39
39
  jar('org.jogamp.gluegen:gluegen-rt-main:${jogl.version}')
data/pom.xml CHANGED
@@ -11,7 +11,7 @@ DO NOT MODIFIY - GENERATED CODE
11
11
  <modelVersion>4.0.0</modelVersion>
12
12
  <groupId>propane</groupId>
13
13
  <artifactId>rp5extras</artifactId>
14
- <version>0.5.0</version>
14
+ <version>0.6.0</version>
15
15
  <name>rp5extras</name>
16
16
  <description>rp5extras for propane</description>
17
17
  <url>https://github.com/monkstone/propane</url>
@@ -58,18 +58,18 @@ DO NOT MODIFIY - GENERATED CODE
58
58
  <jogl.version>2.1.5-01</jogl.version>
59
59
  <jruby.api>http://jruby.org/apidocs/</jruby.api>
60
60
  <source.directory>src</source.directory>
61
- <maven.compiler.target>1.7</maven.compiler.target>
61
+ <maven.compiler.target>1.8</maven.compiler.target>
62
62
  <processing.api>http://processing.github.io/processing-javadocs/core/</processing.api>
63
63
  <propane.basedir>${project.basedir}</propane.basedir>
64
64
  <project.build.sourceEncoding>utf-8</project.build.sourceEncoding>
65
65
  <polyglot.dump.pom>pom.xml</polyglot.dump.pom>
66
- <maven.compiler.source>1.7</maven.compiler.source>
66
+ <maven.compiler.source>1.8</maven.compiler.source>
67
67
  </properties>
68
68
  <dependencies>
69
69
  <dependency>
70
70
  <groupId>org.jruby</groupId>
71
71
  <artifactId>jruby</artifactId>
72
- <version>9.0.5.0</version>
72
+ <version>9.1.0.0</version>
73
73
  <type>pom</type>
74
74
  </dependency>
75
75
  <dependency>
data/propane.gemspec CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |gem|
23
23
  gem.files << 'lib/jogl-all-2.1.5-01-natives-macosx-universal.jar'
24
24
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
25
25
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
26
- gem.add_runtime_dependency 'arcball', '~> 0.0.1'
26
+ gem.add_runtime_dependency 'arcball', '~> 0.0.2'
27
27
  gem.require_paths = ['lib']
28
28
  gem.platform = 'java'
29
29
  end
@@ -19,6 +19,8 @@ public class ColorUtil {
19
19
  /**
20
20
  * Returns hex long as a positive int unless greater than Integer.MAX_VALUE
21
21
  * else return the complement as a negative integer or something like that
22
+ * @param hexlong long
23
+ * @return rgb int
22
24
  */
23
25
  static final int hexLong(long hexlong) {
24
26
  long SPLIT = Integer.MAX_VALUE + 1;
@@ -30,18 +32,49 @@ public class ColorUtil {
30
32
  }
31
33
 
32
34
  /**
33
- *
34
- * @param hexstring
35
- * @return
35
+ * @param hexstring String
36
+ * @return rgb int
36
37
  */
37
38
  static public int colorString(String hexstring) {
38
39
  return java.awt.Color.decode(hexstring).getRGB();
39
40
  }
41
+
42
+ /**
43
+ *
44
+ * @param web Array of web (hex) String
45
+ * @return array of color int according to java
46
+ */
47
+
48
+ static public int[] webArray(String[] web){
49
+ int[] result = new int[web.length];
50
+ for (int i = 0; i < web.length; i++ ){
51
+ result[i] = java.awt.Color.decode(web[i]).getRGB();
52
+ }
53
+ return result;
54
+ }
55
+
56
+ /**
57
+ * Return a ruby string of the form "%w(a b c)" where a, b, c
58
+ * are raw web strings. This string can be used in ruby code.
59
+ * @param hex int array
60
+ * @return String for use in ruby
61
+ */
62
+ static public String rubyString(int[] hex){
63
+ StringBuilder result = new StringBuilder("%w(");
64
+ for (int i = 0; i < hex.length; i++ ){
65
+ result.append(String.format("#%06X", (0xFFFFFF & hex[i])));
66
+ if (i < hex.length - 1){
67
+ result.append(' ');
68
+ }
69
+ }
70
+ result.append(")\n");
71
+ return result.toString();
72
+ }
40
73
 
41
74
  /**
42
75
  *
43
- * @param hex
44
- * @return
76
+ * @param hex double
77
+ * @return hex float
45
78
  */
46
79
  static public float colorLong(double hex) {
47
80
  return (float) hex;
@@ -49,8 +82,8 @@ public class ColorUtil {
49
82
 
50
83
  /**
51
84
  *
52
- * @param hexlong
53
- * @return
85
+ * @param hexlong long
86
+ * @return hexlong int
54
87
  */
55
88
  static public int colorLong(long hexlong){
56
89
  return hexLong(hexlong);
@@ -58,8 +91,8 @@ public class ColorUtil {
58
91
 
59
92
  /**
60
93
  *
61
- * @param hex
62
- * @return
94
+ * @param hex double
95
+ * @return hex float
63
96
  */
64
97
  static public float colorDouble(double hex){
65
98
  return (float)hex;
@@ -0,0 +1,164 @@
1
+ /*
2
+ * Copyright (c) 2016 Martin Prout
3
+ *
4
+ * This library is free software; you can redistribute it and/or
5
+ * modify it under the terms of the GNU Lesser General Public
6
+ * License as published by the Free Software Foundation; either
7
+ * version 2.1 of the License, or (at your option) any later version.
8
+ *
9
+ * http://creativecommons.org/licenses/LGPL/2.1/
10
+ *
11
+ * This library is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with this library; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
+ */
20
+ package monkstone.slider;
21
+
22
+ import processing.core.PApplet;
23
+ import processing.core.PConstants;
24
+
25
+ public class CustomHorizontalSlider extends SliderBar {
26
+
27
+ /**
28
+ *
29
+ * @param outer
30
+ * @param x top left position x
31
+ * @param y left top position y
32
+ * @param length width or height
33
+ * @param beginRange start range
34
+ * @param endRange end range
35
+ * @param label widget label/ID
36
+ */
37
+ public CustomHorizontalSlider(final PApplet outer, int x, int y, int length, float beginRange, float endRange, String label) {
38
+ this.applet = outer;
39
+ this.scrollWheelHandler = (short delta) -> {
40
+ changeWithWheel(delta);
41
+ };
42
+ setActive(true);
43
+ pX = x;
44
+ pY = y;
45
+ pW = length;
46
+ pH = 10;
47
+ ID = label;
48
+ limits(beginRange, endRange);
49
+ }
50
+
51
+ @Override
52
+ boolean mouseOver() {
53
+ return (applet.mouseX >= pX && applet.mouseX <= pX + pW && applet.mouseY >= pY && applet.mouseY <= pY + pH);
54
+ }
55
+
56
+ private void setActive(boolean active) {
57
+ if (active) {
58
+ applet.registerMethod("dispose", this);
59
+ applet.registerMethod("draw", this);
60
+ applet.registerMethod("mouseEvent", this);
61
+ } else {
62
+ applet.unregisterMethod("draw", this);
63
+ applet.unregisterMethod("mouseEvent", this);
64
+ }
65
+ }
66
+
67
+ @Override
68
+ void displayText() {
69
+ String lFormat = "%d";
70
+ if (displayLabel) {
71
+ applet.fill(labelColor);
72
+ applet.textSize(labelSize);
73
+ applet.textAlign(PConstants.CENTER);
74
+ applet.text(Integer.toString((int) pValue), pX + pW / 2, pY + pH / 2 + labelSize / 2 - 2);
75
+ }
76
+ if (displayValue) {
77
+ applet.textSize(numberSize);
78
+ applet.fill(numbersColor);
79
+ applet.textAlign(PConstants.LEFT);
80
+ applet.text(String.format(lFormat, (int) vMin), pX, pY - numberSize / 2);
81
+ applet.textAlign(PConstants.RIGHT);
82
+ applet.text(String.format(lFormat, (int) vMax), pX + pW, pY - numberSize / 2);
83
+ }
84
+ }
85
+
86
+ @Override
87
+ void drawGui() {
88
+ if (backgroundVisible) {
89
+ applet.fill(sliderBack);
90
+ applet.rect(pX, pY, pW, pH);
91
+ }
92
+ applet.fill(sliderFill);
93
+ applet.rect(pX, pY, pScaled, pH);
94
+ }
95
+
96
+ /**
97
+ *
98
+ * @param value
99
+ */
100
+ @Override
101
+ public void setValue(float value) {
102
+ if (value > vMax) {
103
+ value = vMax;
104
+ }
105
+ if (value < vMin) {
106
+ value = vMin;
107
+ }
108
+ pValue = value;
109
+ pScaled = map(pValue, vMin, vMax, 0, pW);
110
+ }
111
+
112
+ @Override
113
+ void checkKeyboard() {
114
+ if (mouseOver()) {
115
+ if (applet.mousePressed && applet.mouseButton == PConstants.LEFT) {
116
+ pValue = constrainMap(applet.mouseX - pX, 0, pW, vMin, vMax);
117
+ }
118
+ if (applet.keyPressed && pressOnlyOnce) {
119
+ if (applet.keyCode == PConstants.LEFT || applet.keyCode == PConstants.DOWN) {
120
+ pValue--;
121
+ }
122
+ if (applet.keyCode == PConstants.RIGHT || applet.keyCode == PConstants.UP) {
123
+ pValue++;
124
+ }
125
+ if (pValue > vMax) {
126
+ pValue = vMax;
127
+ } else {
128
+ pValue = (pValue < vMin) ? vMin : pValue;
129
+ }
130
+ pressOnlyOnce = false;
131
+ }
132
+ deBounce(5);
133
+ pScaled = map(pValue, vMin, vMax, 0, pW);
134
+ }
135
+ }
136
+
137
+ /**
138
+ *
139
+ * @param delta
140
+ */
141
+ @Override
142
+ public void changeWithWheel(int delta) {
143
+ if (!mouseOver()) {
144
+ return;
145
+ }
146
+ if (applet.keyPressed && applet.keyCode == PConstants.SHIFT) {
147
+ delta = delta * (int) (vMax / 10);
148
+ }
149
+ if (applet.keyPressed && applet.keyCode == PConstants.CONTROL) {
150
+ delta = delta * (int) (vMax / 4);
151
+ }
152
+ setValue(pValue + delta);
153
+ }
154
+
155
+ /**
156
+ *
157
+ * @return
158
+ */
159
+ @Override
160
+ public String toString() {
161
+ String geomF = "HorizontalSliderBar.new(%d, %d, %d, %.2f, %.2f, \"%s\")";
162
+ return String.format(geomF, pX, pY, pW, vMin, vMax, ID);
163
+ }
164
+ }