Skip to content

Commit

Permalink
Improved toolbar + fixed vertical overflow problem (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
Louis-Tarvin authored Apr 18, 2023
1 parent a69f4da commit e7c3398
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 19 deletions.
2 changes: 1 addition & 1 deletion pixelot/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pixelot",
"version": "0.0.0",
"version": "0.0.1",
"scripts": {
"ng": "ng",
"start": "ng serve",
Expand Down
Empty file.
4 changes: 2 additions & 2 deletions pixelot/src/app/left-sidebar/left-sidebar.component.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div id="left-sidebar-resizer" (mousedown)="onResizeBarMouseDown($event)"></div>

<mat-tab-group dynamicHeight>
<mat-tab-group dynamicHeight id="left-sidebar-tabs">
<mat-tab label="Layers">
<div id="left-sidebar">
<mat-menu #menu="matMenu">
Expand Down Expand Up @@ -65,4 +65,4 @@
</mat-tab>

<mat-tab label="Shaders"> <app-shader-editor></app-shader-editor> </mat-tab>
</mat-tab-group>
</mat-tab-group>
9 changes: 9 additions & 0 deletions pixelot/src/app/left-sidebar/left-sidebar.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@
border: 2px dashed #ccc;
}

#left-sidebar-tabs {
max-height: 100%;
}

#left-sidebar {
height: 100%;
overflow-y: auto;
}

#left-sidebar-resizer {
position: absolute;
top: 0;
Expand Down
4 changes: 2 additions & 2 deletions pixelot/src/app/right-sidebar/right-sidebar.component.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div id="right-sidebar-resizer" (mousedown)="onResizeBarMouseDown($event)"></div>
<mat-tab-group>
<mat-tab-group id="right-sidebar-tabs">
<mat-tab label="Entities">
<div id="right-sidebar">
<div *ngIf="entity">
Expand Down Expand Up @@ -83,4 +83,4 @@ <h2 class="mat-h2">No entity selected</h2>
</div>
</mat-tab>
<mat-tab label="Systems"> <app-systems-editor></app-systems-editor> </mat-tab>
</mat-tab-group>
</mat-tab-group>
4 changes: 4 additions & 0 deletions pixelot/src/app/right-sidebar/right-sidebar.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
overflow-y: auto;
}

#right-sidebar-tabs {
max-height: 100%;
}

#right-sidebar-resizer {
position: absolute;
top: 0;
Expand Down
8 changes: 4 additions & 4 deletions pixelot/src/app/scene-tab/scene-tab.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
<div class="scene-tab">
<app-left-sidebar [scene]="scene" [layerNames]="layerNames" (entitySelected)="handleEntitySelected($event)"></app-left-sidebar>
<div class="center-wrapper">
<div class="scene-toolbar">
<button mat-icon-button aria-label="Stop" (click)="stopScene()"><mat-icon>stop</mat-icon></button>
<button mat-icon-button aria-label="Play" (click)="playScene()"><mat-icon>play_arrow</mat-icon></button>
</div>
<div class="canvas-wrapper">
<div class="scene-toolbar">
<button mat-icon-button aria-label="Stop" (click)="stopScene()"><mat-icon>stop</mat-icon></button>
<button mat-icon-button aria-label="Play" (click)="playScene()"><mat-icon>play_arrow</mat-icon></button>
</div>
<canvas id="canvas" (mousedown) = "handleMouseDown($event)" (mouseup) = "handleMouseUp($event)"></canvas>
</div>
<app-file-manager></app-file-manager>
Expand Down
38 changes: 28 additions & 10 deletions pixelot/src/app/toolbar/toolbar.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Component, NgZone } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { Router } from '@angular/router';
import { BuildDialogueComponent } from 'app/build-dialogue/build-dialogue.component';
import { NewProjectDialogComponent } from 'app/new-project-dialog/new-project-dialog.component';
import { OpenProjectDialogComponent } from 'app/open-project-dialog/open-project-dialog.component';
Expand All @@ -14,7 +15,7 @@ import * as engine from 'retro-engine';

export class ToolbarComponent {

constructor(public dialog: MatDialog, private zone: NgZone) {
constructor(public dialog: MatDialog, private zone: NgZone, private router: Router) {
let nw = window.nw;
if (nw) {
let menu = new nw.Menu({ type: 'menubar' });
Expand All @@ -36,16 +37,16 @@ export class ToolbarComponent {
});
}
}));
file.append(new nw.MenuItem({ label: 'Save' }));
file.append(new nw.MenuItem({ label: 'Save As' }));
file.append(new nw.MenuItem({
label: 'Close Project',
click: () => {
this.zone.run(() => {
this.router.navigate(['/']);
});
}
}));
menu.append(new nw.MenuItem({ label: 'File', submenu: file }));

let edit = new nw.Menu();
edit.append(new nw.MenuItem({ label: 'Undo' }));
edit.append(new nw.MenuItem({ label: 'Redo' }));
edit.append(new nw.MenuItem({ label: 'Preferences' }));
menu.append(new nw.MenuItem({ label: 'Edit', submenu: edit }));

let game = new nw.Menu();
game.append(new nw.MenuItem({
label: 'Run',
Expand All @@ -69,8 +70,25 @@ export class ToolbarComponent {
}));
menu.append(new nw.MenuItem({ label: 'Game', submenu: game }));

const open = nw.require('open');

let help = new nw.Menu();
help.append(new nw.MenuItem({ label: 'About' }));
help.append(new nw.MenuItem({
label: 'Open Documentation',
click: () => {
open('https://github.com/SLYGM/RetroEngineTM/blob/master/docs/modules.md');
}
}));
help.append(new nw.MenuItem({
label: 'Open GitHub Repository',
click: () => {
open('https://github.com/SLYGM/RetroEngineTM/');
}
}));
help.append(new nw.MenuItem({
label: 'Version: ' + nw.App.manifest.version,
enabled: false
}));
menu.append(new nw.MenuItem({ label: 'Help', submenu: help }));

nw.Window.get().menu = menu;
Expand Down

0 comments on commit e7c3398

Please sign in to comment.