| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- import { Component, OnInit, ViewEncapsulation } from "@angular/core";
- import { ElectronService } from "ngx-electron";
-
- @Component({
- selector: "title-bar",
- templateUrl: "./title-bar.component.html",
- styleUrls: ["./title-bar.component.scss"],
- encapsulation: ViewEncapsulation.Native
- })
- export class TitleBarComponent implements OnInit {
- old: {
- position: number[];
- size: number[];
- };
-
- constructor(private _electron: ElectronService) {}
-
- ngOnInit() {}
-
- minimize() {
- this._electron.remote.getCurrentWindow().minimize();
- }
-
- maximize() {
- let currentWindow = this._electron.remote.getCurrentWindow();
- if (!currentWindow.isMaximized()) {
- this.old = {
- position : currentWindow.getPosition(),
- size : currentWindow.getSize()
- };
- currentWindow.maximize();
- }else if(this.old !== undefined){
- currentWindow.setPosition(this.old.position[0], this.old.position[1], true);
- currentWindow.setSize(this.old.size[0], this.old.size[1], true);
- }
- }
-
- close() {
- this._electron.remote.getCurrentWindow().close();
- }
- }
|