ea 0.6.114 → 0.6.115

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: 251161fffac3b07a12851b0abd26a046998a61b19a9418da8c6d6ceea1cbb09f
4
- data.tar.gz: 549486eec86fb19c6275db6ab7dafdcb7987c1a22b12df2740140e60c7bb2690
3
+ metadata.gz: c4e23583eed4c1a582614c26b2c77ada31ab41af83b00b474fcdc199d807b599
4
+ data.tar.gz: 7c02275d511da08c73e261f53815f8d55092420a7bff501151c5b713162068d6
5
5
  SHA512:
6
- metadata.gz: c5cccbc615740b54619be7e36e4c6edb6382768d97b8a120841aca69018b73e693d9dadb8480e78c9e1e0a18ccfc09122668caf9680571496d99b44372c593cd
7
- data.tar.gz: 87a9b79c59a7102d10aaf4968c052f5a63c1e707ef4daf2376d1278ca79b1317e2fc7d47988d57cb09c5abe88d57aeb12b611ba7066e421a1820ce07ac7ff581
6
+ metadata.gz: 378bb61902c1103887fcc9807e675fd2ebfc2dfe50c7b5266c20f2570b02a42ed0c8b120fc81ca626a6b4d9a421f45d2fd151c21b189714282a50f668ce07b79
7
+ data.tar.gz: 3e4edfe09c4c9235c39e47b6cd202f64bed7904d2b99567cabbff418ecbb7298a1e38b7a0c805fe2e12d760b7e2c11274cf67ee36811925dad804c9c24e61670
@@ -34,7 +34,7 @@ colors:
34
34
 
35
35
  # Stroke widths.
36
36
  strokes:
37
- element_border: 2
37
+ element_border: 1
38
38
  connector_line: 2
39
39
  divider: 2
40
40
  marker: 2
@@ -144,10 +144,23 @@ module Ea
144
144
  font_italic: truthy?(style_hash[:italic]),
145
145
  font_underline: truthy?(style_hash[:ul]),
146
146
  show_tagged_values: truthy?(style_hash[:tag]),
147
+ line_width: effective_line_width(obj_row, style_hash),
147
148
  background_color: style_hash[:bcol]&.to_i
148
149
  )
149
150
  end
150
151
 
152
+ # Negative widths inherit the saved object border, then the diagram theme.
153
+ def effective_line_width(obj_row, style)
154
+ object = database.find_object(obj_row.ea_object_id)
155
+ [style[:lwth], object&.borderwidth].each do |raw|
156
+ next if raw.nil? || raw.to_s.empty?
157
+
158
+ width = raw.to_i
159
+ return width if width >= 0
160
+ end
161
+ nil
162
+ end
163
+
151
164
  def truthy?(raw)
152
165
  raw == "1" || raw == "-1"
153
166
  end
@@ -215,7 +215,7 @@ module Ea
215
215
  private_class_method :overlap_ray?
216
216
 
217
217
  # The QEA builder flags a model relationship drawn without any
218
- # diagram link row; EA strokes it at the 2px box outline.
218
+ # diagram link row; its docks follow the resolved element borders.
219
219
  def default_model_connector?(connector)
220
220
  connector.style.to_h[:phantom_outline] == true && !connector.has_geometry_offsets &&
221
221
  %w[Aggregation Association].include?(connector.connector_type)
@@ -243,16 +243,32 @@ module Ea
243
243
  end
244
244
  private_class_method :border_width?
245
245
 
246
- # Explicit zero-width borders keep that end on the geometric edge;
247
- # absent or inherited widths retain the default outer-stroke docking.
246
+ # EA seats docks on whole pixels; a 1px border keeps the geometric edge.
248
247
  def outline_bounds(box, diagram, ref, duid)
249
- return box if border_width?(diagram, ref, duid, 0)
250
-
251
- Ea::Model::Bounds.new(x: box.x - 1, y: box.y - 1,
252
- width: box.width + 2, height: box.height + 2)
248
+ inset = (outline_width(diagram, ref, duid) / 2.0).floor
249
+ Ea::Model::Bounds.new(x: box.x - inset, y: box.y - inset,
250
+ width: box.width + 2 * inset, height: box.height + 2 * inset)
253
251
  end
254
252
  private_class_method :outline_bounds
255
253
 
254
+ def outline_width(diagram, ref, duid)
255
+ widths = end_placements(diagram, ref, duid).map do |element|
256
+ effective_border_width(element, diagram)
257
+ end.uniq
258
+ widths.size == 1 ? widths.first : diagram.theme.stroke_width
259
+ end
260
+ private_class_method :outline_width
261
+
262
+ def effective_border_width(element, diagram)
263
+ return element.line_width if element.line_width && element.line_width >= 0
264
+
265
+ raw = element.style.to_h[:lwth]
266
+ return raw.to_i if raw && raw.to_i >= 0
267
+
268
+ diagram.theme.stroke_width
269
+ end
270
+ private_class_method :effective_border_width
271
+
256
272
  def end_placements(diagram, ref, duid)
257
273
  placed = Array(diagram&.elements).select { |el| el.model_element_ref == ref }
258
274
  named = placed.select { |el| duid && el.duid.to_s.casecmp?(duid.to_s) }
@@ -169,7 +169,11 @@ module Ea
169
169
  end
170
170
 
171
171
  def title_font_size
172
- legend.heading_size || Ea::Model::Legend::DEFAULT_HEADING_SIZE
172
+ return Ea::Model::Legend::DEFAULT_HEADING_SIZE unless legend.heading_size
173
+
174
+ # HEADINGSIZE is stored in pixels; SVG legend text uses points.
175
+ points = legend.heading_size * 72.0 / 96
176
+ points == points.to_i ? points.to_i : points
173
177
  end
174
178
 
175
179
  def item_font_size
@@ -273,7 +273,7 @@ module Ea
273
273
  classifier: classifier,
274
274
  fill: resolve_fill(element, classifier),
275
275
  stroke: resolve_stroke,
276
- stroke_width: resolve_stroke_width,
276
+ stroke_width: resolve_stroke_width(element),
277
277
  text_fill: theme.text_color,
278
278
  family: family, size: size, size_unit: size_unit, logical_height: logical_height,
279
279
  header_lines: header_lines,
@@ -670,7 +670,9 @@ module Ea
670
670
  color_resolver.stroke_for(nil)
671
671
  end
672
672
 
673
- def resolve_stroke_width
673
+ def resolve_stroke_width(element)
674
+ return element.line_width if element.line_width && element.line_width >= 0
675
+
674
676
  theme.themed? ? theme.stroke_width : DEFAULT_STROKE_WIDTH
675
677
  end
676
678
 
data/lib/ea/version.rb CHANGED
@@ -4,5 +4,5 @@ module Ea
4
4
  # Gem release version. Extracted to its own file so the
5
5
  # `gem-release` tool's `gem bump` can find and update it via the
6
6
  # standard `lib/<gem>/version.rb` convention.
7
- VERSION = "0.6.114"
7
+ VERSION = "0.6.115"
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ea
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.114
4
+ version: 0.6.115
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.