caixanegra 0.3.3 → 0.3.4

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: '085b4f44d1382bda853205ecb18725fd905576b427eb395aa76a8d1dbab1b564'
4
- data.tar.gz: 0b986cb888ef179de7052e789055232e77777082a07f9ddc5aabe5424fa93295
3
+ metadata.gz: 37e8a2fbf540c8bfe1f1c85cf1dd82638bde895abe10bf24369860a6996c1c7b
4
+ data.tar.gz: f65ae1c5c97c7cd8264c157d93748748ec7e8084e7baba2c3f3c7113adfd60d9
5
5
  SHA512:
6
- metadata.gz: 39a3f318ef80818f3b1a5d447884cfa4e8ee650f21eb25dd9c7cd06d7355395b6a5c6858afa96dee8f482574fd07acc6cf102040f98b9840278145fd80f1c6aa
7
- data.tar.gz: 316312a2e90e971956ff6968eb5fa3d376ba9a331037d260d53fec5679a414700cb357c95bcefd994ac2a41cb81bff7883f6c048ec828246688c06ce23ba1a80
6
+ metadata.gz: 7eb792dd9e30f18921dd6ff8c4bab52a9c564f4f93204aeb8925bf5e0255093e64e00dfb9b16b9ac0f19991fccf9868157e17c788cafa66932ef5112f96b187d
7
+ data.tar.gz: '09b9f690181fd28e25f5a8cd25ee1e3588af0c9efdadcd3597676fb80d9b93cbec43563d73a4086314f73fab34b11c27653cab163f10521121dd04c85a53a756'
data/README.md CHANGED
@@ -32,11 +32,14 @@ Caixanegra.setup do |config|
32
32
  config.units = [
33
33
  Caixanegra::Units::AwesomeUnit,
34
34
  Some::Other::Namespace::AnotherAwesomeUnit,
35
- Caixanegra::Units::SuperUnit,
35
+ [Caixanegra::Units::NamespaceOne::SuperUnit, :ns1_super_unit],
36
+ [Caixanegra::Units::NamespaceTwo::SuperUnit, :ns2_super_unit],
36
37
  ]
37
38
  config.transient_store = GreatTransientStore.new
38
39
  end
39
40
  ```
41
+ While configuring units from your codebase, if provided in the array form, **caixanegra** will use the second array item as the class name. Otherwise it will infer from class.
42
+ **NOTE:** You can't have two classes with the same name as **caixanegra** will use the last one
40
43
 
41
44
  With the designer configured, you can use `Caixanegra::Manager` to handle the previously stored definition (or an empty one).
42
45
  This will give you the UID that **caixanegra** designer will understand, using transient store.
@@ -652,7 +652,10 @@ window.Caixanegra.Designer = {
652
652
  createUnit(params) {
653
653
  this.#sequence++;
654
654
  const newUnit = new Caixanegra.Designer.Unit({
655
- position: new Sabertooth.Vector2(20, 20),
655
+ position: new Sabertooth.Vector2(
656
+ -this.gre.worldCenter.x + 20,
657
+ -this.gre.worldCenter.y + 20
658
+ ),
656
659
  type: params.type,
657
660
  title: params.title,
658
661
  class: params.class,
@@ -6,8 +6,13 @@ module Caixanegra
6
6
 
7
7
  scopes = (scope || "").split(",").map(&:to_sym)
8
8
  Caixanegra.units.each do |unit|
9
- if unit.scope.nil? || unit.scope.any? { |checking_scope| scopes.include?(checking_scope) }
10
- units[unit.name.demodulize.underscore.to_sym] = unit
9
+ unit_scope = unit.is_a?(Array) ? unit[0].scope : unit.scope
10
+ if unit_scope.nil? || unit_scope.any? { |checking_scope| scopes.include?(checking_scope) }
11
+ if unit.is_a? Array
12
+ units[unit[1]] = unit[0]
13
+ else
14
+ units[unit.name.demodulize.underscore.to_sym] = unit
15
+ end
11
16
  end
12
17
  end
13
18
 
@@ -18,11 +23,15 @@ module Caixanegra
18
23
  units = {}
19
24
 
20
25
  Caixanegra.units.each do |unit|
21
- units[unit.name.demodulize.underscore.to_sym] = unit
26
+ if unit.is_a? Array
27
+ units[unit[1]] = unit[0]
28
+ else
29
+ units[unit.name.demodulize.underscore.to_sym] = unit
30
+ end
22
31
  end
23
32
 
24
33
  units
25
34
  end
26
35
  end
27
36
  end
28
- end
37
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Caixanegra
4
- VERSION = '0.3.3'
4
+ VERSION = '0.3.4'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caixanegra
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - sergiorribeiro
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-09-04 00:00:00.000000000 Z
11
+ date: 2023-09-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails