Skip to content

Commit

Permalink
feat: allow choosing whether some text will be automatically or manua… (
Browse files Browse the repository at this point in the history
  • Loading branch information
raulgotor authored Jul 14, 2024
1 parent d74f20f commit b4e29a8
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 19 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ and this project adheres to

## [Unreleased]

### Added
* `auto` property to `hide-*` attributes so LinkerScope can explicitly decide whether the attribute should be hidden due to overlapping issues

## [0.3.1] - 2024-02-03

### Added
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -376,9 +376,9 @@ Below a list of style properties with general use and specific for sections:
- `growth-arrow-size`: size of the direction growth arrow. See [`Growths`](#growths) section
- `growth-arrow-fill`: color for the direction growth arrow. See [`Growths`](#growths) section
- `growth-arrow-stroke`: stroke color for the direction growth arrow. See [`Growths`](#growths) section
- `hide-size`: hides the size label of a section
- `hide-name`: hides the name label of a section
- `hide-address`: hides the address label of a section
- `hide-size`: hides the size label of a section [`true | auto | false` ]
- `hide-name`: hides the name label of a section [`true | auto | false` ]
- `hide-address`: hides the address label of a section [`true | auto | false` ]

#### Other properties

Expand Down
13 changes: 6 additions & 7 deletions map_render.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,13 +495,12 @@ def _make_section(self, group, section: Section, area_view):
group.add(self._make_break(section))
else:
group.add(self._make_box(section))
if section.size_y > 20:
if not section.is_name_hidden():
group.add(self._make_name(section))
if not section.is_address_hidden():
group.add(self._make_address(section))
if not section.is_size_hidden():
group.add(self._make_size_label(section))
if not section.is_name_hidden():
group.add(self._make_name(section))
if not section.is_address_hidden():
group.add(self._make_address(section))
if not section.is_size_hidden():
group.add(self._make_size_label(section))

return group

Expand Down
11 changes: 8 additions & 3 deletions section.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,19 @@ def is_grow_down(self):
def is_break(self):
return 'break' in self.flags

def _should_element_be_hidden(self, attribute):
return True if str(attribute) in ['True', 'yes'] \
else False if str(attribute) in ['False', 'no'] \
else self.size_y < 20

def is_address_hidden(self):
return self.style.hide_address
return self._should_element_be_hidden(self.style.hide_address)

def is_name_hidden(self):
return self.style.hide_name
return self._should_element_be_hidden(self.style.hide_name)

def is_size_hidden(self):
return self.style.hide_size
return self._should_element_be_hidden(self.style.hide_size)

@property
def addr_label_pos_x(self):
Expand Down
12 changes: 6 additions & 6 deletions style.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ class Style:
growth_arrow_stroke: str
growth_arrow_fill: str
stroke_dasharray: str
hide_size: bool
hide_name: bool
hide_address: bool
hide_size: str
hide_name: str
hide_address: str

# SVG
fill: str
Expand Down Expand Up @@ -85,8 +85,8 @@ def get_default():
default_style.growth_arrow_stroke = 'black'
default_style.stroke_dasharray = '3,2'
default_style.weight = 2
default_style.hide_size = False
default_style.hide_name = False
default_style.hide_address = False
default_style.hide_size = 'auto'
default_style.hide_name = 'auto'
default_style.hide_address = 'auto'

return default_style

0 comments on commit b4e29a8

Please sign in to comment.