atome 0.5.4.0.9 → 0.5.4.1.0
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/lib/atome/genesis/generators/material.rb +35 -0
- data/lib/atome/renderers/browser/atome.rb +11 -6
- data/lib/atome/renderers/browser/helpers/browser_helper.rb +24 -2
- data/lib/atome/version.rb +1 -1
- data/vendor/assets/src/medias/rubies/examples/drag.rb +1 -1
- data/vendor/assets/src/medias/rubies/examples/vector.rb +31 -0
- data/vendor/assets/src/medias/rubies/examples/video.rb +6 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1de05964aef532fdea97ad87df059c4c8d1680b95c9ff3e4f584bcd497f759d9
|
4
|
+
data.tar.gz: 8ecfcf60c08122af0b74997d779a70e37826668c64abe1b9e557fafa2a60e8d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b0ce2a3feae40b1a21f509699b25857ecbf8d3e3a0f6faa40a673b67ed1c592cb8a4676570e0e23681d83c098c045e48267ab1d3b04dc02b259799c16d79206b
|
7
|
+
data.tar.gz: 3c828d6324954e125c17254cdf5376bdabfde5f4b155ee8c0c15eba9d8d10bdc1a6187176606b3f3207b53e2b927b67046fe496e91a760e2f3b2c336f3e1b666
|
@@ -51,3 +51,38 @@ new({ particle: :remove_classes }) do |value|
|
|
51
51
|
Universe.classes[value].delete(id)
|
52
52
|
end
|
53
53
|
new ({particle: :opacity})
|
54
|
+
|
55
|
+
|
56
|
+
# vector shape
|
57
|
+
new({particle: :definition})
|
58
|
+
|
59
|
+
new({ browser: :definition, type: :string }) do |value, _user_proc|
|
60
|
+
# alert "value is #{value}"
|
61
|
+
target=id
|
62
|
+
`
|
63
|
+
|
64
|
+
var divElement = document.querySelector('#'+#{target});;
|
65
|
+
|
66
|
+
// select the first svg tag inside the div
|
67
|
+
var svgElement = divElement.querySelector('svg');
|
68
|
+
|
69
|
+
// delete the first svg tag inside the div if it exist
|
70
|
+
if (svgElement) {
|
71
|
+
divElement.removeChild(svgElement);
|
72
|
+
}
|
73
|
+
|
74
|
+
|
75
|
+
let svg_content='<svg style="width: 1em; height: 1em;vertical-align: middle;fill: currentColor;overflow: hidden;" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg">'+#{value}+'</svg>'
|
76
|
+
let svgContainer = document.getElementById(#{target});
|
77
|
+
let parser = new DOMParser();
|
78
|
+
let svgDoc = parser.parseFromString(svg_content, "image/svg+xml");
|
79
|
+
let importedSVG = svgDoc.getElementsByTagName("svg")[0];
|
80
|
+
importedSVG.style.width = "100%";
|
81
|
+
importedSVG.style.height = "100%";
|
82
|
+
let elements = importedSVG.getElementsByTagName("path");
|
83
|
+
|
84
|
+
svgContainer.appendChild(importedSVG);
|
85
|
+
|
86
|
+
`
|
87
|
+
|
88
|
+
end
|
@@ -9,12 +9,17 @@ def parents(_val) end
|
|
9
9
|
generator = Genesis.generator
|
10
10
|
|
11
11
|
generator.build_render(:browser_shape) do
|
12
|
-
@
|
13
|
-
|
14
|
-
|
15
|
-
div
|
16
|
-
|
17
|
-
|
12
|
+
if @definition
|
13
|
+
alert :poil
|
14
|
+
else
|
15
|
+
@browser_type = :div
|
16
|
+
id_found = @atome[:id]
|
17
|
+
DOM do
|
18
|
+
div(id: id_found).atome
|
19
|
+
end.append_to(BrowserHelper.browser_document[:user_view])
|
20
|
+
@browser_object = BrowserHelper.browser_document[id_found]
|
21
|
+
end
|
22
|
+
|
18
23
|
end
|
19
24
|
|
20
25
|
generator.build_render(:browser_color) do |_value|
|
@@ -16,13 +16,35 @@ module BrowserHelper
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def self.browser_attach_style(parents, _html_object, atome)
|
19
|
-
|
19
|
+
# we test if the atome has a deinition ( it means hold some vectors infomations)
|
20
|
+
if grab(parents).atome[:definition]
|
21
|
+
tag_style = $document[atome[:id]]
|
22
|
+
# get the content the <style> tag
|
23
|
+
content_style = tag_style.inner_html
|
24
|
+
# extract the color value
|
25
|
+
color_value = content_style[/background-color:\s*([^;}]+)/, 1]
|
26
|
+
`
|
27
|
+
let parser = new DOMParser();
|
28
|
+
var divElement = document.querySelector('#'+#{parents});
|
29
|
+
// select the first svg tag inside the div
|
30
|
+
let foundSVG = divElement.querySelector('svg');
|
31
|
+
let elements = foundSVG.getElementsByTagName("path");
|
32
|
+
Array.from(elements).forEach(el => {
|
33
|
+
el.setAttribute("fill", #{color_value});
|
34
|
+
el.setAttribute("stroke", #{color_value});
|
35
|
+
});
|
36
|
+
`
|
37
|
+
else
|
38
|
+
browser_document[parents].add_class(atome[:id])
|
39
|
+
|
40
|
+
end
|
41
|
+
|
20
42
|
end
|
21
43
|
|
22
44
|
def self.browser_attached_div(children, _html_object, atome)
|
23
45
|
children.each do |child_found|
|
24
46
|
# atome_child.browser_attach_div
|
25
|
-
html_child=grab(child_found).browser_object
|
47
|
+
html_child = grab(child_found).browser_object
|
26
48
|
html_child.append_to(browser_document[atome[:id]])
|
27
49
|
end
|
28
50
|
end
|
data/lib/atome/version.rb
CHANGED
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
|
4
|
+
b=Atome.new(
|
5
|
+
{ shape: { renderers: [:browser], id: :the_shape, type: :shape, attach: [:view],
|
6
|
+
left: 0, right: 0, top: 0, bottom: 0, width: 30, height: 30, overflow: :hidden, tag: {system: false}
|
7
|
+
} })
|
8
|
+
|
9
|
+
edition = <<~STR
|
10
|
+
<path id="p1" d="M257.7 752c2 0 4-0.2 6-0.5L431.9 722c2-0.4 3.9-1.3 5.3-2.8l423.9-423.9c3.9-3.9 3.9-10.2 0-14.1L694.9 114.9c-1.9-1.9-4.4-2.9-7.1-2.9s-5.2 1-7.1 2.9L256.8 538.8c-1.5 1.5-2.4 3.3-2.8 5.3l-29.5 168.2c-1.9 11.1 1.5 21.9 9.4 29.8 6.6 6.4 14.9 9.9 23.8 9.9z m67.4-174.4L687.8 215l73.3 73.3-362.7 362.6-88.9 15.7 15.6-89zM880 836H144c-17.7 0-32 14.3-32 32v36c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-36c0-17.7-14.3-32-32-32z"/>
|
11
|
+
STR
|
12
|
+
b.definition(edition)
|
13
|
+
wait 1 do
|
14
|
+
b.color(:yellow)
|
15
|
+
end
|
16
|
+
copy = <<~STR
|
17
|
+
<path id="p1" d="M672 832 224 832c-52.928 0-96-43.072-96-96L128 160c0-52.928 43.072-96 96-96l448 0c52.928 0 96 43.072 96 96l0 576C768 788.928 724.928 832 672 832zM224 128C206.368 128 192 142.368 192 160l0 576c0 17.664 14.368 32 32 32l448 0c17.664 0 32-14.336 32-32L704 160c0-17.632-14.336-32-32-32L224 128z"/>
|
18
|
+
<path id="p2" d="M800 960 320 960c-17.664 0-32-14.304-32-32s14.336-32 32-32l480 0c17.664 0 32-14.336 32-32L832 256c0-17.664 14.304-32 32-32s32 14.336 32 32l0 608C896 916.928 852.928 960 800 960z"/>
|
19
|
+
<path id="p3" d="M544 320 288 320c-17.664 0-32-14.336-32-32s14.336-32 32-32l256 0c17.696 0 32 14.336 32 32S561.696 320 544 320z"/>
|
20
|
+
<path id="p4" d="M608 480 288.032 480c-17.664 0-32-14.336-32-32s14.336-32 32-32L608 416c17.696 0 32 14.336 32 32S625.696 480 608 480z"/>
|
21
|
+
<path id="p5" d="M608 640 288 640c-17.664 0-32-14.304-32-32s14.336-32 32-32l320 0c17.696 0 32 14.304 32 32S625.696 640 608 640z"/>
|
22
|
+
STR
|
23
|
+
|
24
|
+
|
25
|
+
wait 2 do
|
26
|
+
b.definition(copy)
|
27
|
+
end
|
28
|
+
|
29
|
+
wait 3 do
|
30
|
+
b.color(:orange)
|
31
|
+
end
|
@@ -16,8 +16,12 @@ wait 2 do
|
|
16
16
|
end
|
17
17
|
|
18
18
|
my_video.touch(true) do
|
19
|
-
my_video.play
|
20
|
-
|
19
|
+
if my_video.play == true
|
20
|
+
my_video.pause(true)
|
21
|
+
else
|
22
|
+
my_video.play(true) do |currentTime|
|
23
|
+
puts "play callback time is : #{currentTime}"
|
24
|
+
end
|
21
25
|
end
|
22
26
|
end
|
23
27
|
#############
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: atome
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.4.0
|
4
|
+
version: 0.5.4.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jean-Eric Godard
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-05-
|
11
|
+
date: 2023-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: arduino_firmata
|
@@ -673,6 +673,7 @@ files:
|
|
673
673
|
- vendor/assets/src/medias/rubies/examples/to_px.rb
|
674
674
|
- vendor/assets/src/medias/rubies/examples/top.rb
|
675
675
|
- vendor/assets/src/medias/rubies/examples/touch.rb
|
676
|
+
- vendor/assets/src/medias/rubies/examples/vector.rb
|
676
677
|
- vendor/assets/src/medias/rubies/examples/video.rb
|
677
678
|
- vendor/assets/src/medias/rubies/examples/wait.rb
|
678
679
|
- vendor/assets/src/medias/rubies/examples/web.rb
|