-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
resize buttons work with bugs
- Loading branch information
Showing
7 changed files
with
178 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
firebird-ng/src/app/components/tool-panel/tool-panel.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<div class="tool-panel-wrapper"> | ||
<div class="tool-panel" [class.collapsed]="isCollapsed"> | ||
<div class="content"> | ||
<button class="icon-button toggle-button" title="Toggle Panel" (click)="togglePanel()"> | ||
<mat-icon>{{ isCollapsed ? 'keyboard_arrow_left' : 'keyboard_arrow_right' }}</mat-icon> | ||
</button> | ||
<div class="action-buttons" *ngIf="!isCollapsed"> | ||
<button class="icon-button" title="Zoom In" | ||
(click)="onLeftClick($event, 'zoomIn')" | ||
(mouseup)="clearZoom()" | ||
(mouseleave)="clearZoom()" | ||
(touchend)="clearZoom()" | ||
(touchcancel)="clearZoom()"> | ||
<mat-icon>zoom_in</mat-icon> | ||
</button> | ||
<button class="icon-button" title="Zoom Out" | ||
(click)="onLeftClick($event, 'zoomOut')" | ||
(mouseup)="clearZoom()" | ||
(mouseleave)="clearZoom()" | ||
(touchend)="clearZoom()" | ||
(touchcancel)="clearZoom()"> | ||
<mat-icon>zoom_out</mat-icon> | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
</div> |
50 changes: 50 additions & 0 deletions
50
firebird-ng/src/app/components/tool-panel/tool-panel.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
.tool-panel-wrapper { | ||
position: fixed; | ||
top: 20%; | ||
right: 0; | ||
display: flex; | ||
align-items: center; | ||
} | ||
|
||
.tool-panel { | ||
width: 60px; | ||
height: auto; | ||
background-color: #2e2e2e; | ||
box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1); | ||
border-radius: 8px 0 0 8px; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
transition: transform 0.3s ease; | ||
padding: 10px; | ||
} | ||
|
||
.tool-panel.collapsed { | ||
transform: translateX(calc(100% - 60px)); | ||
} | ||
|
||
.icon-button { | ||
background: none; | ||
border: none; | ||
cursor: pointer; | ||
padding: 10px; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
|
||
border-radius: 50%; | ||
transition: background-color 0.3s ease; | ||
|
||
&:hover { | ||
background-color: #5c5c5c; | ||
} | ||
|
||
mat-icon { | ||
font-size: 24px; | ||
color: white; | ||
} | ||
} | ||
|
||
.toggle-button { | ||
z-index: 1; | ||
} |
23 changes: 23 additions & 0 deletions
23
firebird-ng/src/app/components/tool-panel/tool-panel.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { ToolPanelComponent } from './tool-panel.component'; | ||
|
||
describe('ToolPanelComponent', () => { | ||
let component: ToolPanelComponent; | ||
let fixture: ComponentFixture<ToolPanelComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
imports: [ToolPanelComponent] | ||
}) | ||
.compileComponents(); | ||
|
||
fixture = TestBed.createComponent(ToolPanelComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
72 changes: 72 additions & 0 deletions
72
firebird-ng/src/app/components/tool-panel/tool-panel.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import {Component, Input} from '@angular/core'; | ||
import {NgIf} from "@angular/common"; | ||
import {MatIcon} from "@angular/material/icon"; | ||
import { EventDisplayService } from 'phoenix-ui-components'; | ||
|
||
@Component({ | ||
selector: 'app-tool-panel', | ||
standalone: true, | ||
imports: [ | ||
NgIf, | ||
MatIcon | ||
], | ||
templateUrl: './tool-panel.component.html', | ||
styleUrl: './tool-panel.component.scss' | ||
}) | ||
export class ToolPanelComponent { | ||
isCollapsed = false; | ||
|
||
/** Factor to zoom by. */ | ||
private zoomFactor: number = 1.1; | ||
/** Timeout for clearing mouse hold. */ | ||
private zoomTimeout: any; | ||
/** The speed and time of zoom. */ | ||
private zoomTime: number = 100; | ||
|
||
constructor(private eventDisplay: EventDisplayService) {} | ||
|
||
/** | ||
* Zoom all the cameras by a specific zoom factor. | ||
* The factor may either be greater (zoom in) or smaller (zoom out) than 1. | ||
* @param zoomFactor The factor to zoom by. | ||
*/ | ||
zoomTo(zoomFactor: number) { | ||
this.zoomTime = | ||
this.zoomTime > 30 ? Math.floor(this.zoomTime / 1.1) : this.zoomTime; | ||
|
||
this.eventDisplay.zoomTo(zoomFactor, this.zoomTime); | ||
|
||
this.zoomTimeout = setTimeout(() => { | ||
this.zoomTo(zoomFactor); | ||
}, this.zoomTime); | ||
} | ||
|
||
onLeftClick(event: MouseEvent, action: string) { | ||
if (event.button === 0) { | ||
if (action === 'zoomIn') { | ||
this.zoomIn(); | ||
} else if (action === 'zoomOut') { | ||
this.zoomOut(); | ||
} | ||
} | ||
} | ||
|
||
zoomIn() { | ||
this.zoomTo(1 / this.zoomFactor); | ||
} | ||
zoomOut() { | ||
this.zoomTo(this.zoomFactor); | ||
} | ||
|
||
clearZoom() { | ||
this.zoomTime = 100; | ||
clearTimeout(this.zoomTimeout); | ||
} | ||
|
||
togglePanel() { | ||
this.isCollapsed = !this.isCollapsed; | ||
} | ||
|
||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters