-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This allows to create pictures of any size from the current view, thus not limited by the screen size as is the case with the screenshot mode.
- Loading branch information
Sebastien Ponce
committed
Jan 6, 2023
1 parent
8b924db
commit f2027bb
Showing
11 changed files
with
280 additions
and
0 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
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
7 changes: 7 additions & 0 deletions
7
packages/phoenix-ng/projects/phoenix-app/src/assets/icons/png.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
43 changes: 43 additions & 0 deletions
43
...cts/phoenix-ui-components/lib/components/ui-menu/make-picture/make-picture.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,43 @@ | ||
<mat-menu class="mat-menu" #menu> | ||
<button mat-menu-item (click)="$event.stopPropagation()" class="size-input"> | ||
<label>width</label> | ||
<input | ||
#width | ||
mapInput | ||
type="number" | ||
[value]="3840" | ||
(change)="setWidth(width.value)" | ||
(click)="$event.stopPropagation()" | ||
/> | ||
</button> | ||
<button mat-menu-item (click)="$event.stopPropagation()" class="size-input"> | ||
<label>height</label> | ||
<input | ||
#height | ||
mapInput | ||
type="number" | ||
[value]="2610" | ||
(change)="setHeight(height.value)" | ||
(click)="$event.stopPropagation()" | ||
/> | ||
</button> | ||
<button mat-menu-item (click)="$event.stopPropagation()"> | ||
<mat-radio-group [(ngModel)]="fitting" class="fitting-radios"> | ||
<mat-radio-button *ngFor="let fitting of fittings" [value]="fitting" | ||
>{{ fitting }} | ||
</mat-radio-button> | ||
</mat-radio-group> | ||
</button> | ||
<button mat-menu-item class="make-picture" (click)="makePicture()"> | ||
Create picture | ||
</button> | ||
</mat-menu> | ||
<app-menu-toggle | ||
[matMenuTriggerFor]="menu" | ||
tooltip="Creates picture from current view" | ||
icon="png" | ||
> | ||
</app-menu-toggle> | ||
<div> | ||
<canvas hidden id="screenshotCanvas"></canvas> | ||
</div> |
26 changes: 26 additions & 0 deletions
26
...cts/phoenix-ui-components/lib/components/ui-menu/make-picture/make-picture.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,26 @@ | ||
.size-input { | ||
background: transparent; | ||
color: var(--phoenix-text-color); | ||
text-align: center; | ||
} | ||
|
||
.size-input label { | ||
width: 60px; | ||
} | ||
|
||
.size-input input { | ||
background: transparent; | ||
color: var(--phoenix-text-color); | ||
width: 80px; | ||
} | ||
|
||
.make-picture { | ||
text-align: center; | ||
display: block; | ||
} | ||
|
||
.make-picture span { | ||
padding: 5px 25px; | ||
border: 2px solid var(--phoenix-text-color); | ||
border-radius: 8px; | ||
} |
32 changes: 32 additions & 0 deletions
32
.../phoenix-ui-components/lib/components/ui-menu/make-picture/make-picture.component.test.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,32 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
import { PhoenixUIModule } from '../../phoenix-ui.module'; | ||
|
||
import { MakePictureComponent } from './make-picture.component'; | ||
|
||
describe('MakePictureComponent', () => { | ||
let component: MakePictureComponent; | ||
let fixture: ComponentFixture<MakePictureComponent>; | ||
|
||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
imports: [PhoenixUIModule], | ||
}).compileComponents(); | ||
|
||
fixture = TestBed.createComponent(SSModeComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
component.ngOnInit(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
|
||
it('should call toggleCrop on slide change', () => { | ||
const componentDebug = fixture.debugElement; | ||
const slider = componentDebug.query(By.directive(MatSlideToggle)); | ||
spyOn(component, 'toggleCrop'); // set your spy | ||
slider.triggerEventHandler('change', null); // triggerEventHandler | ||
expect(component.toggleCrop).toHaveBeenCalled(); // event has been called | ||
}); | ||
}); |
28 changes: 28 additions & 0 deletions
28
...jects/phoenix-ui-components/lib/components/ui-menu/make-picture/make-picture.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,28 @@ | ||
import { Component, Input, OnInit, ViewEncapsulation } from '@angular/core'; | ||
import { FormControl, Validators } from '@angular/forms'; | ||
import { EventDisplayService } from '../../../services/event-display.service'; | ||
|
||
@Component({ | ||
selector: 'app-make-picture', | ||
templateUrl: './make-picture.component.html', | ||
styleUrls: ['./make-picture.component.scss'], | ||
encapsulation: ViewEncapsulation.None, | ||
}) | ||
export class MakePictureComponent implements OnInit { | ||
fittings: string[] = ['Crop', 'Stretch']; | ||
fitting: string = 'Crop'; | ||
width: number = 3840; | ||
height: number = 2160; | ||
constructor(private eventDisplay: EventDisplayService) {} | ||
ngOnInit() {} | ||
setWidth(value) { | ||
this.width = value; | ||
} | ||
setHeight(value) { | ||
this.height = value; | ||
} | ||
|
||
makePicture() { | ||
this.eventDisplay.makeScreenShot(this.width, this.height, this.fitting); | ||
} | ||
} |
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