soby 0.1.1.1 → 0.1.1.3
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.
- checksums.yaml +4 -4
- data/bin/soby +6 -4
- data/lib/extensions/backgrounds/circles-bg.rb +26 -0
- data/lib/extensions/backgrounds/circles.rb +156 -0
- data/lib/soby.rb +123 -71
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 848e3ae068e46b6a989ffe10d023ccafe730dc07
|
4
|
+
data.tar.gz: efe6a770edc21dee8dab8572359c0a0e06c5bff5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 036473e69e86bbf51ff788c4b58a5434c3126f2c613a9c7b733a9d7d95844e3bc87051a6f4672633be5b7ba9f98ffdf7ef91dedaf5b84b1b29252ef8ffeec661
|
7
|
+
data.tar.gz: abf72c89abcd52e3e74c4a530777a933d5529afa8fcc25509c5934cac97ace0891f427dcacab546fe84a6aae777ff1250940ea0b73ff0185cca6ab5315cde38d
|
data/bin/soby
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require_relative '../lib/soby'
|
4
|
-
|
3
|
+
# require_relative '../lib/soby'
|
4
|
+
require 'soby'
|
5
5
|
|
6
6
|
Processing::App::SKETCH_PATH = __FILE__
|
7
7
|
$:.unshift File.dirname(__FILE__)
|
@@ -16,15 +16,17 @@ end
|
|
16
16
|
|
17
17
|
require 'java'
|
18
18
|
|
19
|
-
|
20
19
|
Java::TechLityReaSvgextended::PShapeSVGExtended.TEXT_QUALITY = 2.0
|
21
20
|
|
22
21
|
$app = SobyPlayer.new screen_id
|
23
22
|
|
24
23
|
sleep 0.2 while not $app.ready?
|
25
24
|
|
26
|
-
if filename != nil
|
25
|
+
if filename != nil and filename != ""
|
27
26
|
presentation = Soby::load_presentation ARGV[0]
|
28
27
|
Soby::start_presentation presentation
|
29
28
|
end
|
30
29
|
# Soby::auto_update presentation, __FILE__
|
30
|
+
|
31
|
+
# require_relative '../lib/extensions/backgrounds/circles-bg.rb'
|
32
|
+
# load '../lib/extensions/backgrounds/circles-bg.rb'
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
## re-open the class
|
3
|
+
|
4
|
+
require_relative 'circles'
|
5
|
+
|
6
|
+
class SobyPlayer
|
7
|
+
|
8
|
+
## To be overriden by the Presentation Code.
|
9
|
+
def custom_setup
|
10
|
+
@circles = CirclesBackground.new(self, width, height)
|
11
|
+
@setup_done = true
|
12
|
+
end
|
13
|
+
|
14
|
+
def custom_pre_draw
|
15
|
+
# puts "pre draw " + @setup_done.to_s
|
16
|
+
return unless @setup_done
|
17
|
+
|
18
|
+
|
19
|
+
background 0
|
20
|
+
image(@circles.draw, 0, 0, width, height)
|
21
|
+
end
|
22
|
+
|
23
|
+
def custom_post_draw
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
@@ -0,0 +1,156 @@
|
|
1
|
+
#!/usr/bin/env jruby
|
2
|
+
# coding: utf-8
|
3
|
+
# require 'propane'
|
4
|
+
|
5
|
+
## Circles by Bárbara Almeida
|
6
|
+
## A fork of Circle through 3 points by Bárbara Almeida.
|
7
|
+
## Draw circles from 3 points moving on smooth random trajectories.
|
8
|
+
## https://www.openprocessing.org/sketch/211167
|
9
|
+
|
10
|
+
## Propane version by Jérémy Laviole - @poqudrof
|
11
|
+
|
12
|
+
## Propane & JRubyARt compatibility.
|
13
|
+
Propane = Processing if not defined? Propane
|
14
|
+
|
15
|
+
class CirclesBackground
|
16
|
+
include Math
|
17
|
+
include Propane::PConstants
|
18
|
+
|
19
|
+
def initialize(app,w,h)
|
20
|
+
@app,@width,@height = app,w,h
|
21
|
+
@offscreen = @app.createGraphics @width, @height
|
22
|
+
setup
|
23
|
+
end
|
24
|
+
|
25
|
+
def setup
|
26
|
+
@c = @app.random(360)
|
27
|
+
# @points = (0..2).map { Points.new(@app.random(@width), @app.random(@height)) }
|
28
|
+
|
29
|
+
@points = []
|
30
|
+
3.times { @points << Points.new(@app.random(@width),@app.random(@height)) }
|
31
|
+
|
32
|
+
@offscreen.beginDraw
|
33
|
+
@offscreen.background 0
|
34
|
+
# @offscreen.noStroke
|
35
|
+
# @offscreen.rect(0, 0, @width, @height)
|
36
|
+
@offscreen.endDraw
|
37
|
+
end
|
38
|
+
|
39
|
+
def draw
|
40
|
+
|
41
|
+
## Clear once in a while
|
42
|
+
setup if (@app.frame_count % 3_000).zero?
|
43
|
+
|
44
|
+
@points.each do |point|
|
45
|
+
##change direction sometimes
|
46
|
+
point.setDir @app.random(-Propane::PConstants::PI, Propane::PConstants::PI) if (@app.random(1) > 0.96)
|
47
|
+
point.update
|
48
|
+
point.checkEdges
|
49
|
+
end
|
50
|
+
|
51
|
+
@offscreen.beginDraw
|
52
|
+
@offscreen.color_mode(HSB, 360, 100, 100, 100)
|
53
|
+
|
54
|
+
## set the style of the circle
|
55
|
+
## slowly changes hue
|
56
|
+
@dc = Propane::PApplet::map(@app.millis, 0, 150000, 0, 360)
|
57
|
+
@offscreen.stroke((@c + @dc) % 360, 50, 100, 5)
|
58
|
+
@offscreen.no_fill
|
59
|
+
|
60
|
+
## verifies if there is a circle and draw it
|
61
|
+
det = (@points[0].p.x * @points[1].p.y) + (@points[1].p.x * @points[2].p.y) + (@points[2].p.x * @points[0].p.y);
|
62
|
+
det -= (@points[0].p.y * @points[1].p.x) + (@points[1].p.y * @points[2].p.x) + (@points[2].p.y * @points[0].p.x);
|
63
|
+
|
64
|
+
# det = (@points[0].p.x * @points[1].p.y) +
|
65
|
+
# (@points[1].p.x * @points[2].p.y) +
|
66
|
+
# (@points[2].p.x * @points[0].p.y)
|
67
|
+
|
68
|
+
# det -= (@points[0].p.y * @points[1].p.x) +
|
69
|
+
# (@points[1].p.y * @points[2].p.x) +
|
70
|
+
# (@points[2].p.y * @points[0].p.x)
|
71
|
+
|
72
|
+
if Propane::PApplet::abs(det) > 50
|
73
|
+
draw_circle @points
|
74
|
+
end
|
75
|
+
# draw_circle @points if det.abs > 50
|
76
|
+
|
77
|
+
@offscreen.endDraw
|
78
|
+
return @offscreen
|
79
|
+
end
|
80
|
+
|
81
|
+
|
82
|
+
def draw_circle(pts)
|
83
|
+
## find the midpoints of 2 sides
|
84
|
+
mp = []
|
85
|
+
mp[0] = midpoint(pts[0].p, pts[1].p)
|
86
|
+
mp[1] = midpoint(pts[1].p, pts[2].p)
|
87
|
+
|
88
|
+
center_point = center(mp) ## find the center of the circle
|
89
|
+
r = $app.dist(center_point.x, center_point.y, pts[2].p.x, pts[2].p.y) ##calculate the radius
|
90
|
+
|
91
|
+
@offscreen.ellipse(center_point.x, center_point.y, 2*r, 2*r) ## if not collinear display circle
|
92
|
+
end
|
93
|
+
|
94
|
+
def midpoint(a, b)
|
95
|
+
d = $app.dist(a.x, a.y, b.x, b.y) ## distance AB
|
96
|
+
theta = atan2(b.y - a.y, b.x - a.x) ## inclination of AB
|
97
|
+
p = Propane::PVector.new(a.x + d/2* cos(theta),
|
98
|
+
a.y + d/2* sin(theta), # midpoint
|
99
|
+
theta - HALF_PI) #inclination of the bissecteur
|
100
|
+
return p
|
101
|
+
end
|
102
|
+
|
103
|
+
def center(mid_point)
|
104
|
+
eq = []
|
105
|
+
|
106
|
+
## equation of the first bissector (ax - y = -b)
|
107
|
+
mid_point.each do |mp|
|
108
|
+
a = tan mp.z
|
109
|
+
eq << Propane::PVector.new(a,
|
110
|
+
-1,
|
111
|
+
-1*(mp.y - mp.x*a))
|
112
|
+
end
|
113
|
+
|
114
|
+
## calculate x and y coordinates of the center of the circle
|
115
|
+
ox = (eq[1].y * eq[0].z - eq[0].y * eq[1].z) /
|
116
|
+
(eq[0].x * eq[1].y - eq[1].x * eq[0].y)
|
117
|
+
oy = (eq[0].x * eq[1].z - eq[1].x * eq[0].z) /
|
118
|
+
(eq[0].x * eq[1].y - eq[1].x * eq[0].y)
|
119
|
+
return Propane::PVector.new(ox,oy)
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
class Points
|
124
|
+
|
125
|
+
include Propane::Proxy
|
126
|
+
attr_accessor :p, :velocity, :acceleration
|
127
|
+
|
128
|
+
def initialize(x, y)
|
129
|
+
@p = Propane::PVector.new(x, y, 1)
|
130
|
+
@velocity = Propane::PVector.new(0, 0, 0);
|
131
|
+
@acceleration = Propane::PVector.new($app.random(0.2), $app.random(0.2), 0)
|
132
|
+
end
|
133
|
+
|
134
|
+
# change direction
|
135
|
+
def setDir(angle)
|
136
|
+
## direction of the acceleration is defined by the new angle
|
137
|
+
acceleration.set(Propane::PApplet::cos(angle), Propane::PApplet::sin(angle), 0);
|
138
|
+
## magnitude of the acceleration is proportional to the angle between acceleration and velocity
|
139
|
+
acceleration.normalize
|
140
|
+
dif = Propane::PVector::angleBetween(acceleration, velocity)
|
141
|
+
dif = Propane::PApplet::map(dif, 0, Propane::PConstants::PI, 0.1, 0.001)
|
142
|
+
acceleration.mult(dif);
|
143
|
+
end
|
144
|
+
|
145
|
+
def update
|
146
|
+
velocity.add(acceleration);
|
147
|
+
# velocity.limit(1.5);
|
148
|
+
velocity.limit 0.5
|
149
|
+
p.add(velocity);
|
150
|
+
end
|
151
|
+
|
152
|
+
def checkEdges
|
153
|
+
p.x = constrain(p.x, 0, $app.width)
|
154
|
+
p.y = constrain(p.y, 0, $app.height)
|
155
|
+
end
|
156
|
+
end
|
data/lib/soby.rb
CHANGED
@@ -17,13 +17,10 @@ require_relative 'soby/slide'
|
|
17
17
|
require_relative 'soby/cam'
|
18
18
|
require_relative 'soby/launcher'
|
19
19
|
|
20
|
-
|
21
20
|
class SobyPlayer < Processing::App
|
22
21
|
|
23
|
-
|
24
22
|
load_library 'video','video_event', 'SVGExtended'
|
25
23
|
|
26
|
-
|
27
24
|
include_package 'processing.core'
|
28
25
|
|
29
26
|
attr_accessor :prez, :prev_cam, :next_cam, :slides
|
@@ -61,19 +58,57 @@ class SobyPlayer < Processing::App
|
|
61
58
|
def setup
|
62
59
|
@ready = false
|
63
60
|
|
64
|
-
@width = self.width
|
65
|
-
@height = self.height
|
66
61
|
init_player
|
67
62
|
|
68
63
|
@custom_setup_done = true
|
69
64
|
@ready = true
|
70
65
|
@has_thread = false
|
66
|
+
init_key_commands
|
71
67
|
end
|
72
68
|
|
73
|
-
def
|
74
|
-
@
|
69
|
+
def init_key_commands
|
70
|
+
@key_actions = {}
|
71
|
+
|
72
|
+
@key_actions['a'] = ["start autoload",
|
73
|
+
Proc.new {
|
74
|
+
# break or return ?
|
75
|
+
next if @has_thread
|
76
|
+
puts "Thread starting"
|
77
|
+
Soby::auto_update self
|
78
|
+
@has_thread = true
|
79
|
+
}]
|
80
|
+
|
81
|
+
@key_actions['h'] = ["show/hide help",
|
82
|
+
Proc.new do
|
83
|
+
@is_displaying_help = false if @is_displaying_help == nil
|
84
|
+
@is_displaying_help = ! @is_displaying_help
|
85
|
+
end]
|
86
|
+
|
87
|
+
@key_actions['c'] = ["save frame",
|
88
|
+
Proc.new do
|
89
|
+
@frame_number = 1 if @frame_number == nil
|
90
|
+
saveFrame "frame-" + @frame_number.to_s + ".png"
|
91
|
+
@frame_number = @frame_number + 1
|
92
|
+
end ]
|
93
|
+
|
94
|
+
@key_actions['s'] = ["stop autoload",
|
95
|
+
Proc.new { Thread::kill @thread if @has_thread }]
|
96
|
+
|
97
|
+
@key_actions['r'] = ["custom setup restart",
|
98
|
+
Proc.new { @custom_setup_done = false }]
|
99
|
+
|
100
|
+
@key_actions['g'] = ["clean memory", Proc.new { Java::JavaLang::System.gc }]
|
101
|
+
|
102
|
+
@key_actions['l'] = ["load another presentation",
|
103
|
+
Proc.new { load_presentation }
|
104
|
+
]
|
105
|
+
|
75
106
|
end
|
76
107
|
|
108
|
+
|
109
|
+
|
110
|
+
def ready? ; @ready ; end
|
111
|
+
|
77
112
|
def init_player
|
78
113
|
@prez = nil
|
79
114
|
@current_slide_no = 0
|
@@ -99,7 +134,7 @@ class SobyPlayer < Processing::App
|
|
99
134
|
end
|
100
135
|
|
101
136
|
def custom_pre_draw
|
102
|
-
background(
|
137
|
+
background(150)
|
103
138
|
end
|
104
139
|
|
105
140
|
def custom_post_draw
|
@@ -107,7 +142,6 @@ class SobyPlayer < Processing::App
|
|
107
142
|
end
|
108
143
|
|
109
144
|
def draw
|
110
|
-
rect 0, 0, 100, millis / 1000
|
111
145
|
if not @custom_setup_done
|
112
146
|
custom_setup
|
113
147
|
@custom_setup_done = true
|
@@ -115,6 +149,8 @@ class SobyPlayer < Processing::App
|
|
115
149
|
|
116
150
|
custom_pre_draw
|
117
151
|
|
152
|
+
|
153
|
+
|
118
154
|
shapeMode(CORNER)
|
119
155
|
imageMode(CORNER)
|
120
156
|
|
@@ -131,25 +167,58 @@ class SobyPlayer < Processing::App
|
|
131
167
|
display_slide_number
|
132
168
|
end
|
133
169
|
|
170
|
+
|
171
|
+
display_help if @is_displaying_help or @prez == nil
|
172
|
+
|
134
173
|
custom_post_draw
|
135
174
|
end
|
136
175
|
|
176
|
+
def display_help
|
177
|
+
text_size = 12
|
178
|
+
textSize(text_size)
|
179
|
+
|
180
|
+
# fill 200
|
181
|
+
# stroke 180
|
182
|
+
# rect(width/2, height/2, 50, 20);
|
183
|
+
|
184
|
+
fill 200
|
185
|
+
stroke 255
|
186
|
+
|
187
|
+
text "Soby Player", width/2, height/2 if @prez == nil
|
188
|
+
|
189
|
+
translate(50, height - 200)
|
190
|
+
texts = []
|
191
|
+
|
192
|
+
@key_actions.each_pair do |key_name, action|
|
193
|
+
description = action[0]
|
194
|
+
t = "#{key_name} - #{description}"
|
195
|
+
text(t, 0, 0)
|
196
|
+
translate(0, text_size + text_size/2);
|
197
|
+
end
|
198
|
+
|
199
|
+
# texts.each do |t|
|
200
|
+
# text(t, 0, 0)
|
201
|
+
# translate(0, text_size + text_size /2);
|
202
|
+
# end
|
203
|
+
|
204
|
+
end
|
205
|
+
|
137
206
|
def run_slide_code
|
138
207
|
translate 0, 0, 1
|
208
|
+
# puts "run slide code"
|
139
209
|
if not @is_moving and @current_slide_no != 0
|
140
210
|
desc = @prez.slides[@current_slide_no].description
|
141
211
|
if(desc != nil)
|
142
|
-
|
143
|
-
|
212
|
+
# puts "EVAL #{desc}"
|
213
|
+
instance_eval desc
|
144
214
|
end
|
145
215
|
end
|
146
216
|
end
|
147
217
|
|
148
|
-
|
149
218
|
def display_slide_number
|
150
219
|
# Slide number
|
151
220
|
push_matrix
|
152
|
-
translate(
|
221
|
+
translate(self.width - 40, self.height - 45)
|
153
222
|
fill(30)
|
154
223
|
strokeWeight(3)
|
155
224
|
stroke(190)
|
@@ -162,7 +231,7 @@ class SobyPlayer < Processing::App
|
|
162
231
|
translate 2, 0
|
163
232
|
else
|
164
233
|
translate -3.5, 0
|
165
|
-
end
|
234
|
+
end
|
166
235
|
text(@current_slide_no.to_s, 10, 30)
|
167
236
|
pop_matrix
|
168
237
|
end
|
@@ -174,11 +243,10 @@ class SobyPlayer < Processing::App
|
|
174
243
|
alias :default_display_slide_number :display_slide_number
|
175
244
|
|
176
245
|
|
177
|
-
def key_pressed
|
246
|
+
def key_pressed(*args)
|
178
247
|
|
179
|
-
|
180
|
-
|
181
|
-
Java::JavaLang::System.gc
|
248
|
+
@key_actions.each_pair do |key_name, command|
|
249
|
+
command[1][] if key == key_name
|
182
250
|
end
|
183
251
|
|
184
252
|
return if @prez == nil
|
@@ -191,43 +259,7 @@ class SobyPlayer < Processing::App
|
|
191
259
|
next_slide
|
192
260
|
end
|
193
261
|
|
194
|
-
if key == 'l'
|
195
|
-
# selectInput("Select a file to process:",
|
196
|
-
# "fileSelected",
|
197
|
-
# Java::JavaIo::File.new(SKETCH_ROOT))
|
198
|
-
|
199
|
-
folder = Java::JavaIo::File.new(SKETCH_ROOT)
|
200
|
-
fc = Java::javax::swing::JFileChooser.new("Soby Loader")
|
201
|
-
fc.set_dialog_title "Select your presentation"
|
202
|
-
fc.setFileFilter AppFilter.new
|
203
|
-
fc.setCurrentDirectory folder
|
204
|
-
success = fc.show_open_dialog(nil)
|
205
|
-
if success == Java::javax::swing::JFileChooser::APPROVE_OPTION
|
206
|
-
path = fc.get_selected_file.get_absolute_path
|
207
|
-
puts "User selected " + path
|
208
|
-
presentation = Soby::load_presentation path
|
209
|
-
Soby::start_presentation presentation
|
210
|
-
else
|
211
|
-
puts "No file"
|
212
|
-
end
|
213
|
-
end
|
214
262
|
|
215
|
-
if key == 'a'
|
216
|
-
return if @has_thread
|
217
|
-
puts "Thread starting"
|
218
|
-
Soby::auto_update self
|
219
|
-
@has_thread = true
|
220
|
-
end
|
221
|
-
|
222
|
-
if key == 'c'
|
223
|
-
@frame_number = 1 if @frame_number == nil
|
224
|
-
saveFrame "frame-" + @frame_number.to_s + ".png"
|
225
|
-
@frame_number = @frame_number + 1
|
226
|
-
end
|
227
|
-
|
228
|
-
if key == 's'
|
229
|
-
Thread::kill @thread if @has_thread
|
230
|
-
end
|
231
263
|
# puts "slide #{@current_slide_no} "
|
232
264
|
end
|
233
265
|
|
@@ -237,7 +269,7 @@ class SobyPlayer < Processing::App
|
|
237
269
|
|
238
270
|
|
239
271
|
|
240
|
-
def mouse_dragged
|
272
|
+
def mouse_dragged (*args)
|
241
273
|
if not @is_moving
|
242
274
|
tr = PMatrix3D.new
|
243
275
|
tr.translate(mouse_x - pmouse_x, mouse_y - pmouse_y)
|
@@ -258,15 +290,33 @@ class SobyPlayer < Processing::App
|
|
258
290
|
end
|
259
291
|
end
|
260
292
|
|
293
|
+
def load_presentation
|
294
|
+
folder = Java::JavaIo::File.new(SKETCH_ROOT)
|
295
|
+
fc = Java::javax::swing::JFileChooser.new("Soby Loader")
|
296
|
+
fc.set_dialog_title "Select your presentation"
|
297
|
+
fc.setFileFilter AppFilter.new
|
298
|
+
fc.setCurrentDirectory folder
|
299
|
+
success = fc.show_open_dialog(nil)
|
300
|
+
if success == Java::javax::swing::JFileChooser::APPROVE_OPTION
|
301
|
+
path = fc.get_selected_file.get_absolute_path
|
302
|
+
puts "User selected " + path
|
303
|
+
presentation = Soby::load_presentation path
|
304
|
+
Soby::start_presentation presentation
|
305
|
+
else
|
306
|
+
puts "No file"
|
307
|
+
end
|
308
|
+
end
|
309
|
+
|
261
310
|
|
262
311
|
def set_prez (prez)
|
263
|
-
current_slide = @current_slide_no
|
312
|
+
# current_slide = @current_slide_no
|
264
313
|
|
265
314
|
# PShape.loadedImages.clear
|
266
315
|
@prez = prez
|
267
316
|
@slides = prez.slides
|
268
317
|
|
269
|
-
|
318
|
+
# TODO: check slide number, if different go to 0
|
319
|
+
goto_slide 0
|
270
320
|
|
271
321
|
@is_running = true
|
272
322
|
@prez_middle = PVector.new(@prez.width / 2.0, @prez.height / 2.0)
|
@@ -279,8 +329,8 @@ class SobyPlayer < Processing::App
|
|
279
329
|
end
|
280
330
|
|
281
331
|
def compute_view(view, slide_number)
|
282
|
-
# view = createGraphics(@width,
|
283
|
-
# @next_view = createGraphics(@width,
|
332
|
+
# view = createGraphics(@width, self.height, P3D)
|
333
|
+
# @next_view = createGraphics(@width, self.height)
|
284
334
|
view.beginDraw
|
285
335
|
|
286
336
|
cam = slide_view slide_number
|
@@ -314,7 +364,7 @@ class SobyPlayer < Processing::App
|
|
314
364
|
if @slides[@current_slide_no].has_next_animation?
|
315
365
|
puts "Animation Next "
|
316
366
|
anim = @slides[@current_slide_no].next_animation
|
317
|
-
anim.pshape_elem.setVisible(true)
|
367
|
+
anim.pshape_elem.setVisible(true) unless anim.pshape_elem == nil
|
318
368
|
return
|
319
369
|
end
|
320
370
|
|
@@ -416,16 +466,16 @@ class SobyPlayer < Processing::App
|
|
416
466
|
x = @prez.slides[slide_no].x
|
417
467
|
y = @prez.slides[slide_no].y
|
418
468
|
|
419
|
-
sc1 =
|
420
|
-
sc2 =
|
469
|
+
sc1 = self.width.to_f / w.to_f
|
470
|
+
sc2 = self.height.to_f / h.to_f
|
421
471
|
|
422
472
|
# scale
|
423
473
|
sc = [sc1, sc2].min
|
424
474
|
|
425
475
|
|
426
476
|
# translate
|
427
|
-
dx = ((
|
428
|
-
dy = ((
|
477
|
+
dx = ((self.width / sc) - w) * 0.5
|
478
|
+
dy = ((self.height / sc) - h) * 0.5
|
429
479
|
|
430
480
|
cam = Cam.new
|
431
481
|
|
@@ -453,8 +503,8 @@ class SobyPlayer < Processing::App
|
|
453
503
|
my_scale = find_scale
|
454
504
|
|
455
505
|
# centering
|
456
|
-
dx = ((
|
457
|
-
dy = ((
|
506
|
+
dx = ((self.width / my_scale) - @prez.width) * 0.5
|
507
|
+
dy = ((self.height / my_scale) - @prez.height) * 0.5
|
458
508
|
|
459
509
|
cam = Cam.new
|
460
510
|
cam.scale = my_scale
|
@@ -465,8 +515,8 @@ class SobyPlayer < Processing::App
|
|
465
515
|
end
|
466
516
|
|
467
517
|
def find_scale
|
468
|
-
sc1 =
|
469
|
-
sc2 =
|
518
|
+
sc1 = self.width / @prez.width
|
519
|
+
sc2 = self.height / @prez.height
|
470
520
|
return [sc1, sc2].min
|
471
521
|
end
|
472
522
|
private :find_scale
|
@@ -479,10 +529,12 @@ end
|
|
479
529
|
## TODO: move this somewhere
|
480
530
|
class AppFilter < Java::javax::swing::filechooser::FileFilter
|
481
531
|
def accept fobj
|
482
|
-
return true if fobj.
|
483
|
-
return fobj.
|
532
|
+
return true if fobj.getName().end_with?(".svg")
|
533
|
+
# return true if fobj.canExecute
|
534
|
+
# return fobj.isDirectory
|
535
|
+
false
|
484
536
|
end
|
485
537
|
def getDescription
|
486
|
-
"
|
538
|
+
"Soby Presentations"
|
487
539
|
end
|
488
540
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: soby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.1.
|
4
|
+
version: 0.1.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Laviole
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -78,6 +78,8 @@ extensions: []
|
|
78
78
|
extra_rdoc_files: []
|
79
79
|
files:
|
80
80
|
- bin/soby
|
81
|
+
- lib/extensions/backgrounds/circles-bg.rb
|
82
|
+
- lib/extensions/backgrounds/circles.rb
|
81
83
|
- lib/soby.rb
|
82
84
|
- lib/soby/cam.rb
|
83
85
|
- lib/soby/launcher.rb
|
@@ -86,8 +88,7 @@ files:
|
|
86
88
|
- lib/soby/slide.rb
|
87
89
|
- lib/soby/transforms.rb
|
88
90
|
homepage: https://github.com/poqudrof/Soby
|
89
|
-
licenses:
|
90
|
-
- LGPL
|
91
|
+
licenses: []
|
91
92
|
metadata: {}
|
92
93
|
post_install_message: 'Use ''soby presentation.svg 1'' to run a presentation file
|
93
94
|
presentation.svg on screen #1 '
|