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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 81fc451e1fa30a44d57e1fb6405f96e3e9fc8930740c750d9267a89bc2952fa0
4
- data.tar.gz: 9048ed1b43c9a1f8c732a3b63af02a47480a6dd82a33f9c8d0f9e2f36e9a5f57
3
+ metadata.gz: 1de05964aef532fdea97ad87df059c4c8d1680b95c9ff3e4f584bcd497f759d9
4
+ data.tar.gz: 8ecfcf60c08122af0b74997d779a70e37826668c64abe1b9e557fafa2a60e8d5
5
5
  SHA512:
6
- metadata.gz: aa62f9692742e709ce866a2b5eb983d198e15d635ff5a47e1e1a5f809942abd9e8b6a7e3328fcf8fd2bb2b41cf3925ec03f03ee6acc15018ebfef424b2fd05de
7
- data.tar.gz: a2c193b0b0613985aa7c55e425158264dcbd7df127e1b5df5a3b65df2f2a9d2de725059010135f12576604cfe1afb9006f8142bf289c3a70962641ce55df027f
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
- @browser_type = :div
13
- id_found = @atome[:id]
14
- DOM do
15
- div(id: id_found).atome
16
- end.append_to(BrowserHelper.browser_document[:user_view])
17
- @browser_object = BrowserHelper.browser_document[id_found]
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
- browser_document[parents].add_class(atome[:id])
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Atome
4
- VERSION = '0.5.4.0.9'
4
+ VERSION = '0.5.4.1.0'
5
5
  end
@@ -66,7 +66,7 @@ end
66
66
 
67
67
  cc.touch(true) do
68
68
  # alert cc.left
69
- puts "===>ee is : >#{cc.left}"
69
+ puts "===>cc is : >#{cc}"
70
70
  end
71
71
 
72
72
  bb=box({drag: true, color: :yellow})
@@ -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(true) do |currentTime|
20
- puts "play callback time is : #{currentTime}"
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.9
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-16 00:00:00.000000000 Z
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