atome 0.5.7.0.4 → 0.5.7.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 43a34334a41145533d60173178c7320ca20fea32690d6e26919f7dfa0553d2b0
4
- data.tar.gz: 691dc70c3ed9c4849e5d6b597f879207528f1b88f58a948491d162e424e3091f
3
+ metadata.gz: 23166944704e42b25801cc052708c19f265c1f8247dd3ff9b099944ecb415401
4
+ data.tar.gz: 38a31b2cdcc6ceeef5453b926ee4d7eaf704e48c58039830126a94b5a430c188
5
5
  SHA512:
6
- metadata.gz: 72e6d3ad87fc01564331b9c585c6021ab2075b56caf57946e974c3fdebbaa572e92db9edd23b97e014a691d3e000777715bbfc5223f8e8d9ad1230fdb788d6e5
7
- data.tar.gz: 896f6f73134f274736317b1fd3a97e37aa1e0e89dc1dd26aa612363b7492136295747e379e154a319802d506f67ed17462da6b1bc5c9b8d5aefc4ef0f4207a5f
6
+ metadata.gz: 86db3598d96617483482c8e97006bf3fe2e981be529cd871e75b7370b55838002914192c64dcb4b46cf72313f470a91a9ff3f2408fa5914439b84126c924cd44
7
+ data.tar.gz: 655b083c5529f5ed4c642ee5c7457d2940062914433e072a582964ae1e7a4932423731b3a353d0f927d1d6db5b5d56386907d91d7011dfca53979b4e3c532608
@@ -15,7 +15,6 @@ new({ sanitizer: :id }) do |params|
15
15
  # Universe.add_to_atomes(params, self)
16
16
  # end
17
17
 
18
-
19
18
  # Universe.atomes.each do |_aid,atome_f|
20
19
  #
21
20
  # if atome_f.id == params
@@ -64,24 +63,27 @@ end
64
63
 
65
64
  new(particle: :selected, category: :identity, type: :boolean) do |params|
66
65
  if params == true
67
- @selection_style=[]
68
- select_style= border({ thickness: 3, red: 1, green: 1, blue: 1, alpha: 1, pattern: :dotted })
66
+ @selection_style = []
67
+ # select_style= border({ thickness: 3, red: 1, green: 1, blue: 1, alpha: 1, pattern: :dotted })
68
+ default_style = Universe.default_selection_style
69
+ select_style = ''
70
+ default_style.each do |atome_f, part_f|
71
+ select_style = send(atome_f, part_f)
72
+ end
69
73
  @selection_style << select_style.id
70
74
  grab(Universe.current_user).selection << @id
71
75
  elsif params == false
72
- @selection_style.each do |style_f|
73
- remove(style_f)
74
- end
75
- @selection_style=nil
76
+ @selection_style&.each do |style_f|
77
+ remove(style_f)
78
+ end
79
+ @selection_style = nil
76
80
  grab(Universe.current_user).selection.collect.delete(@id)
77
81
  else
78
- @selection_style=[]
79
- params.each do |part_f, val_f|
80
- select_style= send(part_f,val_f)
81
- @selection_style << select_style.id
82
- end
83
- # border({ thickness: 3, red: 1, green: 0, blue: 1, alpha: 1, pattern: :dotted })
84
- # border({ thickness: 10, pattern: :solid, color: :red})
82
+ @selection_style = []
83
+ params.each do |part_f, val_f|
84
+ select_style = send(part_f, val_f)
85
+ @selection_style << select_style.id
86
+ end
85
87
  grab(Universe.current_user).selection << @id
86
88
  end
87
89
  params
@@ -13,37 +13,33 @@ new({ particle: :hide, category: :material, type: :boolean })
13
13
 
14
14
  new({ particle: :remove, category: :property, type: :hash }) do |params|
15
15
 
16
-
17
- if params.instance_of? Hash
16
+ if params.instance_of? Hash
18
17
  if params[:row]
19
18
  data.delete_at(params[:row])
20
-
21
19
  elsif params[:column]
22
20
  column = params[:column]
23
21
  data.map do |hash|
24
22
  hash.delete(hash.keys[column]) if hash.keys[column]
25
- hash
26
23
  end
27
- # elsif params[:all]
28
- # apply.each do |applied_atome|
29
- # if grab(applied_atome).type.to_sym == params[:all].to_sym
30
- # puts "!go"
31
- # end
32
- # end
24
+ # elsif params[:all]
25
+ # apply.each do |applied_atome|
26
+ # if grab(applied_atome).type.to_sym == params[:all].to_sym
27
+ # puts "!go"
28
+ # end
29
+ # end
33
30
  # puts "so_good #{params}"
34
31
  # puts "***> #{apply}"
35
32
  end
33
+
36
34
  params
37
35
  else
38
36
 
39
37
  params
40
38
  end
41
39
 
42
-
43
40
  end
44
41
  # new({ particle: :remove, category: :property, type: :hash })
45
42
 
46
-
47
43
  new({ post: :remove }) do |params|
48
44
  # TODO : we have to rethink the removal of atome and particles (with exception like category) and maybe 'use particle type' to handle removal
49
45
  if params.instance_of?(Hash)
@@ -100,22 +96,22 @@ end
100
96
  new({ particle: :gradient, category: :material, type: :int })
101
97
 
102
98
  new({ particle: :thickness, category: :material, type: :int })
103
- new({ after: :thickness}) do |params|
104
- a=affect.dup # FIXME we have to dup else some items in the array array other duplicated
99
+ new({ after: :thickness }) do |params|
100
+ a = affect.dup # FIXME we have to dup else some items in the array array other duplicated
105
101
  a.each do |atome_to_refresh|
106
102
  grab(atome_to_refresh).apply(id)
107
103
  end
108
104
  params
109
105
  end
110
106
  new({ particle: :pattern, category: :material, type: :string })
111
- new({ after: :pattern })do |params|
112
- a=affect.dup # FIXME we have to dup else some items in the array array other duplicated
107
+ new({ after: :pattern }) do |params|
108
+ a = affect.dup # FIXME we have to dup else some items in the array array other duplicated
113
109
  a.each do |atome_to_refresh|
114
110
  grab(atome_to_refresh).apply(id)
115
111
  end
116
112
  params
117
113
  end
118
114
  # new({ particle: :border, category: :material, type: :int })
119
- new({particle: :fill, category: :material, type: :array })
115
+ new({ particle: :fill, category: :material, type: :array })
120
116
 
121
- new({particle: :opacity, category: :material, type: :int })
117
+ new({ particle: :opacity, category: :material, type: :int })
@@ -25,7 +25,6 @@ def delete_recursive(atome_id)
25
25
  end
26
26
 
27
27
  new({ particle: :delete, category: :utility, type: :boolean, render: false }) do |params|
28
-
29
28
  if params == true
30
29
  # We use the tag persistent to exclude color of system object and other default colors
31
30
  unless @tag && (@tag[:persistent] || @tag[:system])
@@ -38,13 +37,11 @@ new({ particle: :delete, category: :utility, type: :boolean, render: false }) do
38
37
  parent_found = grab(@attach)
39
38
  parent_found.attached.delete(id_found)
40
39
  end
41
- if @affect
42
- @affect.each do |affected_atome|
40
+ @affect&.each do |affected_atome|
43
41
  affected_found = grab(affected_atome)
44
42
  affected_found.apply.delete(id_found)
45
43
  affected_found.refresh
46
44
  end
47
- end
48
45
 
49
46
  # Universe.delete(@aid)
50
47
  end
@@ -27,13 +27,14 @@ class Universe
27
27
  @allow_tool_operations = false
28
28
  @active_tools = []
29
29
  @atome_preset = []
30
+ @default_selection_style={border: { thickness: 3, red: 1, green: 1, blue: 1, alpha: 1, pattern: :dotted }}
30
31
  @applicable_atomes= %i[color shadow border paint animation]
31
32
  # @historicize=false
32
33
  class << self
33
34
  attr_reader :atomes, :atomes_ids, :renderer_list, :molecule_list, :atome_list, :particle_list, :classes, :counter,
34
35
  :atomes_specificities
35
36
  attr_accessor :connected, :allow_sync, :allow_localstorage, :database_ready, :edit_mode, :tools,
36
- :allow_tool_operations, :active_tools, :atome_preset, :applicable_atomes
37
+ :allow_tool_operations, :active_tools, :atome_preset, :applicable_atomes, :default_selection_style
37
38
 
38
39
  def messages
39
40
  @messages
@@ -388,7 +388,7 @@ class Atome
388
388
  def particles_to_hash
389
389
  hash = {}
390
390
  instance_variables.each do |var|
391
- next if %i[@html_object @history @initialized @tick @controller_proc].include?(var)
391
+ next if %i[@selection_style @html_object @history @initialized @tick @controller_proc].include?(var)
392
392
  hash[var.to_s.delete('@').to_sym] = instance_variable_get(var)
393
393
  end
394
394
  hash
data/lib/atome/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
 
3
3
  # return atome version
4
4
  class Atome
5
- VERSION = '0.5.7.0.4'
5
+ VERSION = '0.5.7.0.5'
6
6
  end
@@ -44,13 +44,13 @@ new({ method: :remove, renderer: :html, type: :string }) do |object_id_to_remove
44
44
  html.style("boxShadow", 'none')
45
45
  html.style("filter", 'none')
46
46
  @apply.delete(object_id_to_remove)
47
- apply(@apply)
47
+ # apply(@apply)
48
48
  when :border
49
49
  # alert :poipoipoipoipo
50
50
  html.style("border", 'none')
51
- # html.style("filter", 'none')
51
+ html.style("filter", 'none')
52
52
  @apply.delete(object_id_to_remove)
53
- apply(@apply)
53
+ # apply(@apply)
54
54
  when :paint
55
55
  atome_to_remove = grab(object_id_to_remove)
56
56
  atome_to_remove.gradient.each do |color_id|
@@ -9,7 +9,6 @@ b.instance_variable_set("@path", './medias/images/red_planet.png' )
9
9
 
10
10
  b.instance_variable_set("@smooth", 30)
11
11
  wait 1 do
12
- # alert b.inspect
13
12
  b.refresh
14
13
  b.instance_variable_set("@left", 300)
15
14
  wait 1 do
@@ -24,13 +23,13 @@ wait 1 do
24
23
  end
25
24
  end
26
25
  end
27
- # i=image(:green_planet)
26
+ i=image(:green_planet)
28
27
  # alert i.path
29
- # i.instance_variable_set("@path", './medias/images/red_planet.png')
30
- # wait 2 do
31
- # i.refresh
32
- # # i.path'./medias/images/red_planet.png'
33
- # end
28
+ i.instance_variable_set("@path", './medias/images/red_planet.png')
29
+ wait 2 do
30
+ i.refresh
31
+ # i.path'./medias/images/red_planet.png'
32
+ end
34
33
 
35
34
 
36
35
  #
@@ -1,22 +1,28 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # grab(:a_styles).data
4
3
  t = text({ data: 'touch me to select all', id: :the_text })
5
4
  b = box({ left: 12, id: :the_box })
6
- c = circle({ left: 230, id: :the_circle })
7
- c.color(:green)
8
- # c.touch(true) do
9
- # if c.selected
10
- # c.selected(false)
11
- # else
12
- # # example of custom selection style
13
- # c.selected({ shadow: {
14
- # left: 9, top: 3, blur: 9,
15
- # invert: false,
16
- # red: 0, green: 0, blue: 0, alpha: 1
17
- # }, border: { thickness: 5, red: 1, green: 1, blue: 1, alpha: 1, pattern: :dotted, id: :the_door,inside: true } })
18
- # end
19
- # end
5
+ c = circle({ left: 230, id: :the_circle, color: { blue: 1, id: :c1 } })
6
+ c.color({ green: 1, id: :c2 })
7
+ # to change default selection style
8
+ Universe.default_selection_style = { border: { thickness: 3, red: 1, green: 0, blue: 1, alpha: 1, pattern: :dotted } }
9
+
10
+ c.touch(true) do
11
+ if c.selected
12
+ c.selected(false)
13
+ else
14
+ # c.selected(true)
15
+ # example of custom selection style
16
+ c.selected({ shadow: { id: :titi,
17
+ left: 9, top: 3, blur: 9,
18
+ invert: false,
19
+ red: 0, green: 0, blue: 0, alpha: 1
20
+ }, border: { id: :toto, thickness: 5, red: 1, green: 1, blue: 1, alpha: 1,
21
+ pattern: :dotted, inside: true }
22
+ })
23
+ end
24
+ end
25
+
20
26
  image({ path: 'medias/images/red_planet.png', id: :the__red_planet, top: 233 })
21
27
 
22
28
  t.touch(true) do
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.7.0.4
4
+ version: 0.5.7.0.5
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: 2024-04-25 00:00:00.000000000 Z
11
+ date: 2024-04-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: artoo