Skip to content
This repository was archived by the owner on Dec 11, 2023. It is now read-only.

Commit 7902488

Browse files
author
clittle
committed
Tweaked spacing values to make them more reliant on the border config
value
1 parent 3d60dc6 commit 7902488

2 files changed

Lines changed: 19 additions & 15 deletions

File tree

layers/exporters/svg_objects.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,9 @@ def build(height, width, label, config, variant='text', t1text=None, t2text=None
268268
lines = len(patch_text)
269269
y = theight/2 + 2.1
270270
if lines > 1:
271-
y = y - (theight / 5 * (lines-1))
271+
y = y - (theight / 5 * (lines - 1))
272+
if float(fs) < (convertToPx(config.border, config.unit) + 2.1):
273+
y = y - (theight / 5)
272274
t1 = Text("\n".join(patch_text), fs, '', x=4, y=y)
273275
upper.append(t1)
274276
if bu:

layers/exporters/svg_templates.py

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ def _build_headers(self, name, config, desc=None, filters=None, gradient=None):
6060
psych = 0
6161
overlay = None
6262
if config.showHeader:
63-
64-
root = G(tx=5, ty=5, style='font-family: {}'.format(ff))
63+
border = convertToPx(config.border, config.unit)
64+
root = G(tx=border, ty=border, style='font-family: {}'.format(ff))
6565

6666
header = G()
6767
root.append(header)
@@ -76,16 +76,16 @@ def _build_headers(self, name, config, desc=None, filters=None, gradient=None):
7676
if config.showLegend and gradient is not False and config.legendDocked:
7777
header_count += 1
7878

79-
operation_x = (max_x - 10) - (15 * (header_count - 1))
79+
operation_x = (max_x - border) - (1.5 * border * (header_count - 1))
8080
if header_count > 0:
8181
header_width = operation_x / header_count
8282
if config.showAbout:
8383
if desc is not None:
84-
g = SVG_HeaderBlock().build(height=header_height, width=header_width, label='about', t1text=name,
85-
t2text=desc, config=config)
84+
g = SVG_HeaderBlock().build(height=header_height, width=header_width, label='about',
85+
t1text=name, t2text=desc, config=config)
8686
else:
87-
g = SVG_HeaderBlock().build(height=header_height, width=header_width, label='about', t1text=name,
88-
config=config)
87+
g = SVG_HeaderBlock().build(height=header_height, width=header_width, label='about',
88+
t1text=name, config=config)
8989
b1.append(g)
9090
psych += 1
9191
if config.showFilters:
@@ -96,7 +96,7 @@ def _build_headers(self, name, config, desc=None, filters=None, gradient=None):
9696
fi.stages = ["act"]
9797
g2 = SVG_HeaderBlock().build(height=header_height, width=header_width, label='filters',
9898
t1text=', '.join(fi.platforms), t2text=fi.stages[0], config=config)
99-
b2 = G(tx=operation_x / header_count * psych + 15 * psych)
99+
b2 = G(tx=operation_x / header_count * psych + 1.5 * border * psych)
100100
header.append(b2)
101101
b2.append(g2)
102102
psych += 1
@@ -111,7 +111,7 @@ def _build_headers(self, name, config, desc=None, filters=None, gradient=None):
111111
(gr.compute_color(int(gr.minValue + div * i)), gr.minValue + div * i))
112112
colors.append((gr.compute_color(gr.maxValue), gr.maxValue))
113113
if config.legendDocked:
114-
b3 = G(tx=operation_x / header_count * psych + 15 * psych)
114+
b3 = G(tx=operation_x / header_count * psych + 1.5 * border * psych)
115115
g3 = SVG_HeaderBlock().build(height=header_height, width=header_width, label='legend',
116116
variant='graphic', colors=colors, config=config)
117117
header.append(b3)
@@ -218,9 +218,10 @@ def export(self, showName, showID, lhandle, config, sort=0, scores=[], colors=[]
218218
grad)
219219
self.codex = self.h._adjust_ordering(self.codex, sort, scores)
220220
self.lhandle = lhandle
221-
glob = G()
222-
index = 5
221+
index = 0
223222
lengths = []
223+
border = convertToPx(config.border, config.unit)
224+
glob = G(tx=border)
224225
for x in self.codex:
225226
su = len(x.techniques)
226227
for enum in exclude:
@@ -231,14 +232,15 @@ def export(self, showName, showID, lhandle, config, sort=0, scores=[], colors=[]
231232
if y in [z[0] for z in subtechs]:
232233
su += len(x.subtechniques[y])
233234
lengths.append(su)
234-
tech_width = (convertToPx(config.width, config.unit) / sum([1 for x in lengths if x > 0])) - 10
235+
tech_width = ((convertToPx(config.width, config.unit) - 1.2 * border) / sum([1 for x in lengths if x > 0])) - \
236+
border
235237
header_offset = convertToPx(config.headerHeight, config.unit)
236238
if presence == 0:
237239
header_offset = 0
238-
header_offset += 15
240+
header_offset += 2.5 * border
239241
tech_height = (convertToPx(config.height, config.unit) - header_offset -
240242
convertToPx(config.border, config.unit)) / (max(lengths) + 1)
241-
incre = tech_width + 10
243+
incre = tech_width + 1.1 * border
242244
for x in self.codex:
243245
disp = ''
244246
if showName and showID:

0 commit comments

Comments
 (0)