dedalus 0.2.0 → 0.2.1
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/dedalus +2 -2
- data/lib/dedalus/app_view_composer.rb +3 -2
- data/lib/dedalus/application_view.rb +2 -8
- data/lib/dedalus/elements/image.rb +8 -13
- data/lib/dedalus/elements/image_grid.rb +50 -0
- data/lib/dedalus/elements/sprite.rb +24 -0
- data/lib/dedalus/elements/void.rb +16 -0
- data/lib/dedalus/elements.rb +68 -9
- data/lib/dedalus/image_repository.rb +15 -0
- data/lib/dedalus/palette.rb +1 -1
- data/lib/dedalus/pattern_library/application.rb +1 -1
- data/lib/dedalus/pattern_library/application_view.rb +1 -0
- data/lib/dedalus/pattern_library/atoms/code.rb +9 -0
- data/lib/dedalus/pattern_library/atoms/tiny_text.rb +9 -0
- data/lib/dedalus/pattern_library/molecules/library_item_example.rb +3 -2
- data/lib/dedalus/pattern_library/molecules/library_section_tab.rb +4 -7
- data/lib/dedalus/pattern_library/molecules/periodic_table_entry.rb +5 -6
- data/lib/dedalus/pattern_library/organisms/library_entry.rb +3 -3
- data/lib/dedalus/pattern_library/screens/app_screen.rb +21 -2
- data/lib/dedalus/pattern_library/templates/app_template.rb +2 -2
- data/lib/dedalus/pattern_library.rb +3 -0
- data/lib/dedalus/version.rb +1 -1
- data/lib/dedalus/view_traversal.rb +29 -7
- data/lib/dedalus.rb +5 -0
- data/media/images/controls.png +0 -0
- data/media/images/cosmos.jpg +0 -0
- data/media/images/tiles.png +0 -0
- metadata +11 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b87e77ef8b41ec61f19f7b84e31853dc27e2c28
|
4
|
+
data.tar.gz: 2a4a4ab7156a738647dea2c1e99ce60f28c03b6d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e81bb797a355ffa07f9a7b52f148dda150645eebebd28591d5ad9498dd85b79f9fc1940c079b449e0f990e8696527790b4759f3185158c924f756db54c8c6c37
|
7
|
+
data.tar.gz: 92e2de9cc81a726c45e99a6d9b6a31e8fb3426e56ad6b79808b50b0d767c3aba71ae0bc0dd685b3b67e5db2fad2c4014cbd7c10c33e61a279b36c130ae74544f
|
data/bin/dedalus
CHANGED
@@ -8,8 +8,8 @@ if File.directory?(File.join(root,'.git'))
|
|
8
8
|
require 'dedalus'
|
9
9
|
Dedalus::PatternLibrary::Application.kickstart!({
|
10
10
|
setup: {
|
11
|
-
library_name: "Dedalus
|
12
|
-
module_to_search: Dedalus::
|
11
|
+
library_name: "Dedalus",
|
12
|
+
module_to_search: Dedalus::Elements
|
13
13
|
}
|
14
14
|
})
|
15
15
|
rescue LoadError => e
|
@@ -33,7 +33,7 @@ module Dedalus
|
|
33
33
|
|
34
34
|
def render!(structure, dims)
|
35
35
|
traverse(structure, origin: [0,0], dimensions: dims) do
|
36
|
-
on_atom do |atom, origin:, dimensions:|
|
36
|
+
on_atom do |atom, origin:, dimensions:, freeform:|
|
37
37
|
if atom.background_color
|
38
38
|
atom.draw_bounding_box(
|
39
39
|
color: atom.background_color,
|
@@ -41,7 +41,8 @@ module Dedalus
|
|
41
41
|
dimensions: dimensions
|
42
42
|
)
|
43
43
|
end
|
44
|
-
|
44
|
+
|
45
|
+
atom.position = origin unless freeform
|
45
46
|
atom.render
|
46
47
|
end
|
47
48
|
|
@@ -17,9 +17,8 @@ module Dedalus
|
|
17
17
|
def compose(screen)
|
18
18
|
screen = composer.hover_molecule(screen, dimensions, mouse_position: mouse_position)
|
19
19
|
composer.render!(screen, dimensions)
|
20
|
-
|
21
|
-
cursor.
|
22
|
-
cursor.render
|
20
|
+
# cursor.position = mouse_position
|
21
|
+
# cursor.render
|
23
22
|
end
|
24
23
|
|
25
24
|
def dimensions
|
@@ -35,11 +34,6 @@ module Dedalus
|
|
35
34
|
end
|
36
35
|
end
|
37
36
|
|
38
|
-
protected
|
39
|
-
def cursor
|
40
|
-
@cursor ||= Elements::Icon.for :arrow_cursor
|
41
|
-
end
|
42
|
-
|
43
37
|
private
|
44
38
|
def composer
|
45
39
|
@composer ||= Dedalus::ApplicationViewComposer.new
|
@@ -1,19 +1,15 @@
|
|
1
1
|
module Dedalus
|
2
2
|
module Elements
|
3
|
-
class ImageRepository
|
4
|
-
def self.lookup(path)
|
5
|
-
@images ||= {}
|
6
|
-
@images[path] ||= Gosu::Image.new(path)
|
7
|
-
@images[path]
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
3
|
class Image < Dedalus::Atom
|
12
|
-
attr_accessor :path, :padding
|
4
|
+
attr_accessor :path, :padding, :z_order
|
13
5
|
|
14
6
|
def render
|
15
7
|
x,y = *position
|
16
|
-
asset.draw(x + padding, y + padding,
|
8
|
+
asset.draw(x + padding, y + padding, z_order, scale, scale)
|
9
|
+
end
|
10
|
+
|
11
|
+
def z_order
|
12
|
+
@z_order ||= ZOrder::Foreground
|
17
13
|
end
|
18
14
|
|
19
15
|
def width
|
@@ -29,7 +25,7 @@ module Dedalus
|
|
29
25
|
end
|
30
26
|
|
31
27
|
def padding
|
32
|
-
@padding ||=
|
28
|
+
@padding ||= 0.0
|
33
29
|
end
|
34
30
|
|
35
31
|
def scale
|
@@ -44,9 +40,8 @@ module Dedalus
|
|
44
40
|
"an image"
|
45
41
|
end
|
46
42
|
|
47
|
-
private
|
48
43
|
def asset
|
49
|
-
@asset ||= ImageRepository.lookup(path)
|
44
|
+
@asset ||= Dedalus::ImageRepository.lookup(path)
|
50
45
|
end
|
51
46
|
end
|
52
47
|
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module Dedalus
|
2
|
+
module Elements
|
3
|
+
class ImageGrid < Dedalus::Molecule
|
4
|
+
attr_accessor :grid, :tiles_path, :tile_width, :tile_height
|
5
|
+
|
6
|
+
def show
|
7
|
+
grid.map do |row|
|
8
|
+
row.map do |grid_value|
|
9
|
+
if grid_value
|
10
|
+
sprite_for(grid_value)
|
11
|
+
else
|
12
|
+
no_image
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def height
|
19
|
+
grid.length * tile_height
|
20
|
+
end
|
21
|
+
|
22
|
+
def sprite_for(frame)
|
23
|
+
Sprite.new(frame: frame, width: tile_width, height: tile_height, path: tiles_path)
|
24
|
+
end
|
25
|
+
|
26
|
+
def no_image
|
27
|
+
Void.new(height: tile_height, width: tile_width)
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.description
|
31
|
+
"a grid of images"
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.example_data
|
35
|
+
{
|
36
|
+
tiles_path: "media/images/tiles.png",
|
37
|
+
tile_width: 64,
|
38
|
+
tile_height: 64,
|
39
|
+
grid: [
|
40
|
+
[ nil, 0, 2, 0 ],
|
41
|
+
[ 0, nil, 1, 0 ],
|
42
|
+
[ 0, 0, nil, 0 ],
|
43
|
+
[ 0, 1, 2, nil ],
|
44
|
+
]
|
45
|
+
}
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Dedalus
|
2
|
+
module Elements
|
3
|
+
class Sprite < Image
|
4
|
+
attr_accessor :width, :height, :frame
|
5
|
+
|
6
|
+
def asset
|
7
|
+
@asset ||= Dedalus::ImageRepository.lookup_tiles(path, width, height)[frame]
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.example_data
|
11
|
+
{
|
12
|
+
path: "media/images/tiles.png",
|
13
|
+
frame: 0,
|
14
|
+
width: 64,
|
15
|
+
height: 64
|
16
|
+
}
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.description
|
20
|
+
"an animated image"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Dedalus
|
2
|
+
module Elements
|
3
|
+
class Void < Dedalus::Atom
|
4
|
+
attr_accessor :width, :height
|
5
|
+
def render(*); end
|
6
|
+
|
7
|
+
def self.description
|
8
|
+
'an empty space'
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.example_data
|
12
|
+
{ width: 300, height: 300 }
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/dedalus/elements.rb
CHANGED
@@ -8,10 +8,11 @@ module Dedalus
|
|
8
8
|
end
|
9
9
|
|
10
10
|
class FontRepository
|
11
|
-
def self.get_font(size: 20)
|
11
|
+
def self.get_font(font_name='Helvetica',size: 20)
|
12
12
|
@fonts ||= {}
|
13
|
-
@fonts[
|
14
|
-
@fonts[size]
|
13
|
+
@fonts[font_name] ||= {}
|
14
|
+
@fonts[font_name][size] ||= Gosu::Font.new(size, name: font_name)
|
15
|
+
@fonts[font_name][size]
|
15
16
|
end
|
16
17
|
end
|
17
18
|
|
@@ -31,29 +32,37 @@ module Dedalus
|
|
31
32
|
attrs.each { |(k,v)| instance_variable_set(:"@#{k}",v) } unless attrs.nil?
|
32
33
|
end
|
33
34
|
|
34
|
-
def draw_bounding_box(origin:, dimensions:, color: Palette.gray)
|
35
|
+
def draw_bounding_box(origin:, dimensions:, color: Palette.gray)
|
35
36
|
x,y = *origin
|
36
37
|
w,h = *dimensions
|
37
38
|
|
38
39
|
raise "Invalid color #{color} given to #{self.class.name} for bounding box" unless color.is_a?(Dedalus::Color)
|
39
40
|
|
40
41
|
c = color.to_gosu
|
41
|
-
window.draw_quad(x,y,c,
|
42
|
-
x,y+h,c,
|
43
|
-
x+w,y,c,
|
44
|
-
x+w,y+h,c,ZOrder::Background)
|
42
|
+
window.draw_quad(x, y, c,
|
43
|
+
x, y+h, c,
|
44
|
+
x+w, y, c,
|
45
|
+
x+w, y+h, c,ZOrder::Background)
|
45
46
|
end
|
46
47
|
|
47
48
|
def view
|
48
49
|
Dedalus.active_view
|
49
50
|
end
|
50
51
|
|
52
|
+
def tiny_font
|
53
|
+
FontRepository.get_font(size: 14)
|
54
|
+
end
|
55
|
+
|
56
|
+
def code_font
|
57
|
+
FontRepository.get_font('courier new', size: 18)
|
58
|
+
end
|
59
|
+
|
51
60
|
def font
|
52
61
|
FontRepository.get_font(size: 20)
|
53
62
|
end
|
54
63
|
|
55
64
|
def big_font
|
56
|
-
FontRepository.get_font(size:
|
65
|
+
FontRepository.get_font(size: 24)
|
57
66
|
end
|
58
67
|
|
59
68
|
def huge_font
|
@@ -67,6 +76,54 @@ module Dedalus
|
|
67
76
|
|
68
77
|
###
|
69
78
|
|
79
|
+
class Container < Element
|
80
|
+
def initialize(contents, attrs={})
|
81
|
+
@contents = contents
|
82
|
+
super(attrs)
|
83
|
+
end
|
84
|
+
|
85
|
+
def show
|
86
|
+
@contents
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
# layer is an abstract element...
|
91
|
+
# maybe should also pull out rows and columns?
|
92
|
+
# could cleanup traversal impl, and will be clearer ultimately
|
93
|
+
class Layer < Element
|
94
|
+
def initialize(elements, freeform: false)
|
95
|
+
@elements = elements
|
96
|
+
@freeform = freeform
|
97
|
+
end
|
98
|
+
|
99
|
+
def show
|
100
|
+
@elements
|
101
|
+
end
|
102
|
+
|
103
|
+
def freeform?
|
104
|
+
@freeform == true
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
# it's like a gluon or something, not sure how to model in nuclear terms
|
109
|
+
class LayerStack < Element
|
110
|
+
attr_reader :layers
|
111
|
+
|
112
|
+
def initialize(layers: [])
|
113
|
+
@layers = []
|
114
|
+
end
|
115
|
+
|
116
|
+
def push(layer_elements)
|
117
|
+
@layers.push(layer_elements)
|
118
|
+
end
|
119
|
+
|
120
|
+
# def each
|
121
|
+
# @layers.each
|
122
|
+
# end
|
123
|
+
end
|
124
|
+
|
125
|
+
###
|
126
|
+
|
70
127
|
class Atom < Element
|
71
128
|
attr_accessor :scale, :padding
|
72
129
|
end
|
@@ -88,6 +145,8 @@ module Dedalus
|
|
88
145
|
class Screen < Element
|
89
146
|
end
|
90
147
|
|
148
|
+
###
|
149
|
+
|
91
150
|
module ZOrder
|
92
151
|
Background, Foreground, Text, Overlay = *(0..5)
|
93
152
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Dedalus
|
2
|
+
class ImageRepository
|
3
|
+
def self.lookup(path)
|
4
|
+
@images ||= {}
|
5
|
+
@images[path] ||= Gosu::Image.new(path)
|
6
|
+
@images[path]
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.lookup_tiles(path, width, height)
|
10
|
+
@tiles ||= {}
|
11
|
+
@tiles[path] ||= Gosu::Image::load_tiles(path, width, height)
|
12
|
+
@tiles[path]
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/dedalus/palette.rb
CHANGED
@@ -14,7 +14,7 @@ module Dedalus
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def find_descendants_of(klass, module_to_search)
|
17
|
-
ObjectSpace.each_object(Class).select { |k| k < klass &&
|
17
|
+
ObjectSpace.each_object(Class).select { |k| k < klass && k.name.deconstantize == module_to_search.name }
|
18
18
|
end
|
19
19
|
|
20
20
|
def create_library(module_to_search:, name:)
|
@@ -9,9 +9,10 @@ module Dedalus
|
|
9
9
|
|
10
10
|
def show
|
11
11
|
[
|
12
|
-
|
12
|
+
TinyText.new(text: "EXAMPLE", height_percent: 0.05, background_color: background_color.darken),
|
13
13
|
item,
|
14
|
-
|
14
|
+
TinyText.new(text: "DATA", height_percent: 0.05, background_color: background_color.darken),
|
15
|
+
Code.new(text: item_data, background_color: Palette.decode_color('darkgray'), padding: 10)
|
15
16
|
]
|
16
17
|
end
|
17
18
|
|
@@ -4,10 +4,7 @@ module Dedalus
|
|
4
4
|
attr_accessor :icon, :name, :description, :scale, :highlight, :section_color
|
5
5
|
|
6
6
|
def show
|
7
|
-
[[
|
8
|
-
icon_element, [ title_element,
|
9
|
-
description_element ]
|
10
|
-
]]
|
7
|
+
Container.new([[icon_element, [ title_element, description_element ]]], padding: 16)
|
11
8
|
end
|
12
9
|
|
13
10
|
def hover
|
@@ -33,15 +30,15 @@ module Dedalus
|
|
33
30
|
end
|
34
31
|
|
35
32
|
def icon_element
|
36
|
-
Elements::Icon.for(icon, padding:
|
33
|
+
Elements::Icon.for(icon, padding: 10)
|
37
34
|
end
|
38
35
|
|
39
36
|
def title_element
|
40
|
-
|
37
|
+
Elements::Heading.new(text: name)
|
41
38
|
end
|
42
39
|
|
43
40
|
def description_element
|
44
|
-
|
41
|
+
TinyText.new(text: description)
|
45
42
|
end
|
46
43
|
|
47
44
|
def self.description
|
@@ -9,9 +9,8 @@ module Dedalus
|
|
9
9
|
def show
|
10
10
|
[
|
11
11
|
HugeText.new(text: abbreviation, scale: scale),
|
12
|
-
|
13
|
-
|
14
|
-
Elements::Paragraph.new(text: kind, scale: 0.6 * scale)
|
12
|
+
LargeText.new(text: element_name, scale: scale),
|
13
|
+
TinyText.new(text: kind, scale: scale)
|
15
14
|
]
|
16
15
|
end
|
17
16
|
|
@@ -40,7 +39,7 @@ module Dedalus
|
|
40
39
|
end
|
41
40
|
|
42
41
|
def width
|
43
|
-
|
42
|
+
260 * scale
|
44
43
|
end
|
45
44
|
|
46
45
|
def height
|
@@ -62,8 +61,8 @@ module Dedalus
|
|
62
61
|
|
63
62
|
def self.example_data
|
64
63
|
{
|
65
|
-
element_abbreviation: "
|
66
|
-
element_name: "
|
64
|
+
element_abbreviation: "Ht",
|
65
|
+
element_name: "Huge Text"
|
67
66
|
}
|
68
67
|
end
|
69
68
|
end
|
@@ -9,9 +9,9 @@ module Dedalus
|
|
9
9
|
|
10
10
|
def show
|
11
11
|
[
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
HugeText.new(text: title),
|
13
|
+
LargeText.new(text: subtitle),
|
14
|
+
TinyText.new(text: description)
|
15
15
|
] + [ library_items ]
|
16
16
|
end
|
17
17
|
|
@@ -6,15 +6,34 @@ module Dedalus
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def show
|
9
|
-
|
9
|
+
layers
|
10
10
|
end
|
11
11
|
|
12
|
-
def
|
12
|
+
def layers
|
13
|
+
layer_stack = Dedalus::LayerStack.new
|
14
|
+
layer_stack.push(Dedalus::Layer.new(background_image))
|
15
|
+
layer_stack.push(Dedalus::Layer.new(@template))
|
16
|
+
layer_stack.push(Dedalus::Layer.new(cursor, freeform: true))
|
17
|
+
layer_stack
|
18
|
+
end
|
19
|
+
|
20
|
+
def background_image
|
21
|
+
@bg_image ||= Elements::Image.new(path: "media/images/cosmos.jpg", z_order: -1)
|
22
|
+
end
|
23
|
+
|
24
|
+
def cursor
|
25
|
+
@cursor ||= Elements::Icon.for :arrow_cursor
|
26
|
+
end
|
27
|
+
|
28
|
+
def hydrate(mouse_position:, library_section_tabs:, current_entry_name:, library_sections:, library_items:)
|
13
29
|
@template.library_name = "Dedalus Pattern Library"
|
14
30
|
@template.library_section_tabs = library_section_tabs
|
15
31
|
@template.library_sections = library_sections
|
16
32
|
@template.library_items = library_items
|
17
33
|
@template.current_entry_name = current_entry_name
|
34
|
+
|
35
|
+
cursor.position = mouse_position
|
36
|
+
|
18
37
|
self
|
19
38
|
end
|
20
39
|
end
|
@@ -3,7 +3,10 @@ require 'dedalus/pattern_library/models/library_section'
|
|
3
3
|
require 'dedalus/pattern_library/models/library_item'
|
4
4
|
|
5
5
|
require 'dedalus/pattern_library/atoms/large_text'
|
6
|
+
require 'dedalus/pattern_library/atoms/tiny_text'
|
6
7
|
require 'dedalus/pattern_library/atoms/huge_text'
|
8
|
+
require 'dedalus/pattern_library/atoms/code'
|
9
|
+
|
7
10
|
require 'dedalus/pattern_library/molecules/library_section_tab'
|
8
11
|
# require 'dedalus/pattern_library/molecules/library_item_molecule'
|
9
12
|
require 'dedalus/pattern_library/molecules/library_item_example'
|
data/lib/dedalus/version.rb
CHANGED
@@ -19,14 +19,14 @@ module Dedalus
|
|
19
19
|
@element_callback = blk
|
20
20
|
end
|
21
21
|
|
22
|
-
def walk!(structure, origin:, dimensions:)
|
22
|
+
def walk!(structure, origin:, dimensions:, freeform: false)
|
23
23
|
width, height = *dimensions
|
24
24
|
height = structure.height if !structure.is_a?(Array) && structure.height
|
25
25
|
width = structure.width if !structure.is_a?(Array) && structure.width
|
26
26
|
x0, y0 = *origin
|
27
27
|
|
28
28
|
if structure.is_a?(Dedalus::Atom)
|
29
|
-
@atom_callback.call(structure, origin: origin, dimensions: dimensions) if @atom_callback
|
29
|
+
@atom_callback.call(structure, origin: origin, dimensions: dimensions, freeform: freeform) if @atom_callback
|
30
30
|
elsif structure.is_a?(Dedalus::Element)
|
31
31
|
# an element *other than* an atom, we need to call #show on it
|
32
32
|
margin = structure.margin || 0.0
|
@@ -42,13 +42,18 @@ module Dedalus
|
|
42
42
|
@element_callback.call(structure, origin: margin_origin, dimensions: margin_dims)
|
43
43
|
end
|
44
44
|
|
45
|
-
pad = structure.padding ||
|
46
|
-
# x,y = x0+pad, y0+pad
|
45
|
+
pad = structure.padding || 0.0
|
47
46
|
pad_origin = [x+pad,y+pad]
|
48
47
|
pad_dims = [width - pad*2 - margin*2, height - pad*2 - margin*2 ]
|
49
48
|
|
50
|
-
|
51
|
-
|
49
|
+
if structure.is_a?(LayerStack)
|
50
|
+
layers = structure.layers
|
51
|
+
layers.each do |layer|
|
52
|
+
walk!(layer, origin: pad_origin, dimensions: pad_dims, freeform: layer.freeform?)
|
53
|
+
end
|
54
|
+
else
|
55
|
+
walk!(structure.show, origin: pad_origin, dimensions: pad_dims, freeform: freeform)
|
56
|
+
end
|
52
57
|
elsif structure.is_a?(Array) # we have a set of rows
|
53
58
|
walk_rows!(structure, origin: origin, dimensions: dimensions)
|
54
59
|
end
|
@@ -63,7 +68,16 @@ module Dedalus
|
|
63
68
|
y = y0 + height_cursor
|
64
69
|
dims = [width, current_row_height]
|
65
70
|
if row.is_a?(Array)
|
66
|
-
|
71
|
+
extra_columns = true
|
72
|
+
while extra_columns
|
73
|
+
row = walk_columns!(row, origin: [x0, y], dimensions: dims)
|
74
|
+
if row.empty?
|
75
|
+
extra_columns = false
|
76
|
+
else
|
77
|
+
height_cursor += row.first.height
|
78
|
+
y = y0 + height_cursor
|
79
|
+
end
|
80
|
+
end
|
67
81
|
else
|
68
82
|
walk!(row, origin: [x0,y], dimensions: dims)
|
69
83
|
end
|
@@ -73,6 +87,7 @@ module Dedalus
|
|
73
87
|
def walk_columns!(columns, origin:, dimensions:)
|
74
88
|
width, height = *dimensions
|
75
89
|
x0, y0 = *origin
|
90
|
+
|
76
91
|
subdivide_line(columns, distance: width, attr: :width) do |column, current_column_width, width_cursor|
|
77
92
|
x = x0 + width_cursor
|
78
93
|
dims = [ current_column_width, height ]
|
@@ -121,9 +136,16 @@ module Dedalus
|
|
121
136
|
end
|
122
137
|
end
|
123
138
|
|
139
|
+
if distance_cursor > distance - current_element_distance # ??
|
140
|
+
return elements.slice(index,elements.size)
|
141
|
+
end
|
142
|
+
|
124
143
|
yield(element, current_element_distance, distance_cursor)
|
125
144
|
distance_cursor += current_element_distance
|
126
145
|
end
|
146
|
+
|
147
|
+
# no overflowing elements...
|
148
|
+
[]
|
127
149
|
end
|
128
150
|
end
|
129
151
|
end
|
data/lib/dedalus.rb
CHANGED
@@ -2,17 +2,22 @@ require 'joyce'
|
|
2
2
|
require 'geometer'
|
3
3
|
|
4
4
|
require 'dedalus/version'
|
5
|
+
|
5
6
|
require 'dedalus/view_traversal'
|
6
7
|
require 'dedalus/app_view_composer'
|
7
8
|
require 'dedalus/application_view'
|
8
9
|
|
9
10
|
require 'dedalus/palette'
|
11
|
+
require 'dedalus/image_repository'
|
10
12
|
|
11
13
|
require 'dedalus/elements'
|
14
|
+
require 'dedalus/elements/void'
|
12
15
|
require 'dedalus/elements/text'
|
13
16
|
require 'dedalus/elements/heading'
|
14
17
|
require 'dedalus/elements/paragraph'
|
15
18
|
require 'dedalus/elements/image'
|
16
19
|
require 'dedalus/elements/icon'
|
20
|
+
require 'dedalus/elements/sprite'
|
21
|
+
require 'dedalus/elements/image_grid'
|
17
22
|
|
18
23
|
require 'dedalus/pattern_library'
|
Binary file
|
Binary file
|
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dedalus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joseph Weissman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: joyce
|
@@ -169,14 +169,20 @@ files:
|
|
169
169
|
- lib/dedalus/elements/heading.rb
|
170
170
|
- lib/dedalus/elements/icon.rb
|
171
171
|
- lib/dedalus/elements/image.rb
|
172
|
+
- lib/dedalus/elements/image_grid.rb
|
172
173
|
- lib/dedalus/elements/paragraph.rb
|
174
|
+
- lib/dedalus/elements/sprite.rb
|
173
175
|
- lib/dedalus/elements/text.rb
|
176
|
+
- lib/dedalus/elements/void.rb
|
177
|
+
- lib/dedalus/image_repository.rb
|
174
178
|
- lib/dedalus/palette.rb
|
175
179
|
- lib/dedalus/pattern_library.rb
|
176
180
|
- lib/dedalus/pattern_library/application.rb
|
177
181
|
- lib/dedalus/pattern_library/application_view.rb
|
182
|
+
- lib/dedalus/pattern_library/atoms/code.rb
|
178
183
|
- lib/dedalus/pattern_library/atoms/huge_text.rb
|
179
184
|
- lib/dedalus/pattern_library/atoms/large_text.rb
|
185
|
+
- lib/dedalus/pattern_library/atoms/tiny_text.rb
|
180
186
|
- lib/dedalus/pattern_library/library_view.rb
|
181
187
|
- lib/dedalus/pattern_library/models/library.rb
|
182
188
|
- lib/dedalus/pattern_library/models/library_item.rb
|
@@ -199,6 +205,9 @@ files:
|
|
199
205
|
- media/icons/house.png
|
200
206
|
- media/icons/molecule.png
|
201
207
|
- media/icons/paramecium.png
|
208
|
+
- media/images/controls.png
|
209
|
+
- media/images/cosmos.jpg
|
210
|
+
- media/images/tiles.png
|
202
211
|
- spec/dedalus_spec.rb
|
203
212
|
- spec/spec_helper.rb
|
204
213
|
homepage: https://rubygems.org/gems/dedalus
|