Skip to content

Commit

Permalink
(henck#85) Render panel section headers; add font size setting
Browse files Browse the repository at this point in the history
  • Loading branch information
henck committed May 12, 2020
1 parent 2c3a36f commit d139686
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/panels/renderPanel/RenderPanel.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@
</div>

<div class="tab-body" id="tab-settings-basic">
<div class="sec">Grid settings</div>
<id-check class="js-grid-visible" data-label="Visible"></id-check>
<id-check class="js-grid-origin" data-label="Show origin"></id-check>
<id-check class="js-grid-snap" data-label="Snap to grid"></id-check>
<id-range class="js-grid-size" data-min="16" data-max="128" data-label="Grid size"></id-range>

<label>Map colors</label>
<div class="sec">Map colors</div>
<div style="display: flex">
<div style="display: flex; flex-direction: column; flex-wrap: wrap">
<id-popup title="Map background" class="map-colortype selected" data-type="background">
Expand All @@ -28,7 +29,10 @@
<id-colorpicker class="js-map-color"></id-colorpicker>
</div>

<label>Quick themes</label>
<div class="sec">Font settings</div>
<id-range class="js-font-size" data-min="6" data-max="32" data-label="Font size"></id-range>

<div class="sec">Quick themes</div>
<div class="menuitem">
<a href="#" class="js-theme-diagram"><svg class="icon small"><use xlink:href="dist/icons.svg#paintbrush"></use></svg> Diagram</a>
</div>
Expand Down
4 changes: 4 additions & 0 deletions src/panels/renderPanel/RenderPanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export class RenderPanel extends Panel implements Subscriber {
private mapColorPicker: IdColorPicker;
private mapColorType: string;
private mapColorButtons: Array<IdPopup>;
private ctrlFontSize: IdRange;

private ctrlRoomWidth: IdRange;
private ctrlRoomHeight: IdRange;
Expand Down Expand Up @@ -78,6 +79,8 @@ export class RenderPanel extends Panel implements Subscriber {
buttons[i].addEventListener('click', () => { this.onMapColorButton(popup); });
}

this.ctrlFontSize = new IdRange('.js-font-size', this.elem).addEventListener('input', () => { App.map.settings.basic.fontSize = this.ctrlFontSize.value; });

this.elem.querySelector('.js-theme-diagram').addEventListener('click', () => { this.applyTheme('diagram'); });
this.elem.querySelector('.js-theme-obsidian').addEventListener('click', () => { this.applyTheme('obsidian'); });
this.elem.querySelector('.js-theme-hand-drawn').addEventListener('click', () => { this.applyTheme('hand-drawn'); });
Expand Down Expand Up @@ -163,6 +166,7 @@ export class RenderPanel extends Panel implements Subscriber {
this.ctrlGridOrigin.checked = App.map.settings.grid.origin;
this.ctrlGridSnap.checked = App.map.settings.grid.snap;
this.ctrlGridSize.value = App.map.settings.grid.size;
this.ctrlFontSize.value = App.map.settings.basic.fontSize;

this.ctrlRoomWidth.value = App.map.settings.room.width;
this.ctrlRoomHeight.value = App.map.settings.room.height;
Expand Down
10 changes: 9 additions & 1 deletion styl/typography.styl
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,12 @@ kbd
background-color rgb(200,200,200)
color black
padding 1px 4px 1px 4px
margin-right 4px
margin-right 4px

.sec
color #333
font-weight bold
background #eeeeee
padding 4px
margin 4px 0 6px 0
border-radius 2px

0 comments on commit d139686

Please sign in to comment.