caixanegra 0.3.2 → 0.3.4
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/README.md +4 -1
- data/app/assets/javascripts/caixanegra/designer.js +4 -1
- data/lib/caixanegra/manager.rb +1 -1
- data/lib/caixanegra/unit_helper.rb +13 -4
- data/lib/caixanegra/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 37e8a2fbf540c8bfe1f1c85cf1dd82638bde895abe10bf24369860a6996c1c7b
|
4
|
+
data.tar.gz: f65ae1c5c97c7cd8264c157d93748748ec7e8084e7baba2c3f3c7113adfd60d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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(
|
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,
|
data/lib/caixanegra/manager.rb
CHANGED
@@ -6,8 +6,13 @@ module Caixanegra
|
|
6
6
|
|
7
7
|
scopes = (scope || "").split(",").map(&:to_sym)
|
8
8
|
Caixanegra.units.each do |unit|
|
9
|
-
|
10
|
-
|
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
|
-
|
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
|
data/lib/caixanegra/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2023-09-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|