dedalus 0.2.19 → 0.2.20
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dedalus/app_view_composer.rb +4 -8
- data/lib/dedalus/application_view.rb +1 -2
- data/lib/dedalus/elements/image_grid.rb +6 -2
- data/lib/dedalus/elements/sprite_field.rb +3 -1
- data/lib/dedalus/image_repository.rb +6 -2
- data/lib/dedalus/pattern_library/application.rb +1 -1
- data/lib/dedalus/version.rb +1 -1
- data/lib/dedalus/view_traversal.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f4879b973c1147f12956e1662b1f9d45c5b2d1c
|
4
|
+
data.tar.gz: 0e4d0a4ecb3f7509d0a6f3ba1a1bc250031e5500
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ffb664d2e7632fc989db85de4dd98c36c727ec7c4faac2a6e01b76f1922afc49fe6d94b9172e5a5c807473cb2ebb2e3f24326398cf37e543bda775d4d0a43ed8
|
7
|
+
data.tar.gz: 3bd94eda18f255f79126803f36c2c291ba787b3f34bc15cf76f3856fcee7e3ac3a367e0e5471210112a078bea8ca5c84124e8e7a952b574a3dccfeca5cc8a425
|
@@ -5,14 +5,13 @@ module Dedalus
|
|
5
5
|
|
6
6
|
def traverse(structure, origin: [0,0], dimensions:, render: false, &blk)
|
7
7
|
traversal = ViewTraversal.new(&blk)
|
8
|
-
|
9
|
-
structure
|
8
|
+
traversal.walk!(structure, origin: origin, dimensions: dimensions, render: render)
|
10
9
|
end
|
11
10
|
|
12
11
|
def send_molecule(structure, window_dims, mouse_position:, message:)
|
13
12
|
mouse_coord = coord(*mouse_position)
|
14
13
|
|
15
|
-
|
14
|
+
traverse(structure, origin: [0,0], dimensions: window_dims, render: false) do
|
16
15
|
on_molecule do |molecule, origin:, dimensions:, z_index:|
|
17
16
|
element_bounding_box = Geometer::Rectangle.new(coord(*origin), dim(*dimensions))
|
18
17
|
mouse_overlap = element_bounding_box.contains?(mouse_coord) rescue false # could get bad coords...
|
@@ -20,12 +19,8 @@ module Dedalus
|
|
20
19
|
molecule.position = origin
|
21
20
|
molecule.send(message)
|
22
21
|
end
|
23
|
-
|
24
|
-
molecule
|
25
22
|
end
|
26
23
|
end
|
27
|
-
|
28
|
-
updated_structure
|
29
24
|
end
|
30
25
|
|
31
26
|
def hover_molecule(structure, window_dims, mouse_position:)
|
@@ -47,7 +42,8 @@ module Dedalus
|
|
47
42
|
)
|
48
43
|
end
|
49
44
|
|
50
|
-
|
45
|
+
# TODO may need to do this to get click/hover events for sprites?
|
46
|
+
if freeform # then offset by origin
|
51
47
|
x0,y0 = *origin
|
52
48
|
x,y = *atom.position
|
53
49
|
atom.position = [x+x0,y+y0]
|
@@ -10,7 +10,6 @@ module Dedalus
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def click
|
13
|
-
p [ :app_view_click ]
|
14
13
|
composer.click_molecule(
|
15
14
|
app_screen,
|
16
15
|
[window.width, window.height],
|
@@ -20,7 +19,7 @@ module Dedalus
|
|
20
19
|
|
21
20
|
def compose(screen)
|
22
21
|
composer.hover_molecule(screen, dimensions, mouse_position: mouse_position)
|
23
|
-
composer.render!(screen
|
22
|
+
composer.render!(screen, dimensions)
|
24
23
|
end
|
25
24
|
|
26
25
|
def dimensions
|
@@ -2,7 +2,7 @@ module Dedalus
|
|
2
2
|
module Elements
|
3
3
|
class ImageGrid < Dedalus::Molecule
|
4
4
|
attr_accessor :grid, :tiles_path, :tile_width, :tile_height, :tile_class
|
5
|
-
attr_accessor :scale
|
5
|
+
attr_accessor :scale, :redraw_tiles
|
6
6
|
|
7
7
|
def show
|
8
8
|
if grid
|
@@ -29,7 +29,11 @@ module Dedalus
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def record?
|
32
|
-
grid && !grid.empty?
|
32
|
+
(grid && !grid.empty?)
|
33
|
+
end
|
34
|
+
|
35
|
+
def rerecord?
|
36
|
+
redraw_tiles
|
33
37
|
end
|
34
38
|
|
35
39
|
def width
|
@@ -3,6 +3,7 @@ module Dedalus
|
|
3
3
|
class SpriteField < Dedalus::Organism
|
4
4
|
attr_accessor :grid, :sprite_map, :scale, :camera_location
|
5
5
|
attr_accessor :tile_width, :tile_height, :tiles_path, :tile_class
|
6
|
+
attr_accessor :redraw_tiles
|
6
7
|
|
7
8
|
def show
|
8
9
|
layers
|
@@ -48,7 +49,8 @@ module Dedalus
|
|
48
49
|
tile_class: tile_class,
|
49
50
|
scale: scale,
|
50
51
|
offset: camera_offset,
|
51
|
-
name: 'sprite-field-tiles'
|
52
|
+
name: 'sprite-field-tiles',
|
53
|
+
redraw_tiles: redraw_tiles
|
52
54
|
)
|
53
55
|
end
|
54
56
|
|
@@ -12,10 +12,14 @@ module Dedalus
|
|
12
12
|
@tiles[path]
|
13
13
|
end
|
14
14
|
|
15
|
-
def self.lookup_recording(id,width,height,window,&blk)
|
15
|
+
def self.lookup_recording(id,width,height,window,force:false,&blk)
|
16
16
|
# p [ :lookup_recording, id: id ]
|
17
17
|
@recordings ||= {}
|
18
|
-
|
18
|
+
if force
|
19
|
+
@recordings[id] = window.record(width.to_i,height.to_i,&blk)
|
20
|
+
else
|
21
|
+
@recordings[id] ||= window.record(width.to_i,height.to_i,&blk)
|
22
|
+
end
|
19
23
|
@recordings[id]
|
20
24
|
end
|
21
25
|
|
data/lib/dedalus/version.rb
CHANGED
@@ -73,7 +73,7 @@ module Dedalus
|
|
73
73
|
end
|
74
74
|
else
|
75
75
|
if structure.record? && render
|
76
|
-
recorded_image = ImageRepository.lookup_recording(structure.name, structure.width, structure.height, structure.window) do
|
76
|
+
recorded_image = ImageRepository.lookup_recording(structure.name, structure.width, structure.height, structure.window, force: structure.rerecord?) do
|
77
77
|
walk!(structure.shown, origin: [0,0], dimensions: pad_dims, freeform: freeform, render: render)
|
78
78
|
end
|
79
79
|
|