Skip to content

Commit 6d1455f

Browse files
Add upperCenter() positioning method (#77)
1 parent bfbc40c commit 6d1455f

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

resources/electron/electron-plugin/dist/libs/positioner/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ class Positioner {
7474
x: Math.floor(screenSize.x + (screenSize.width / 2 - windowSize[0] / 2)),
7575
y: Math.floor((screenSize.height + screenSize.y) / 2 - windowSize[1] / 2),
7676
},
77+
upperCenter: {
78+
x: Math.floor(screenSize.x + (screenSize.width / 2 - windowSize[0] / 2)),
79+
y: Math.floor(screenSize.y + (screenSize.height - windowSize[1]) / 3),
80+
},
7781
};
7882
if (position.substr(0, 4) === "tray") {
7983
if (positions[position].x + windowSize[0] >

resources/electron/electron-plugin/src/libs/positioner/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,14 @@ class Positioner {
117117
(screenSize.height + screenSize.y) / 2 - windowSize[1] / 2,
118118
),
119119
},
120+
upperCenter: {
121+
x: Math.floor(
122+
screenSize.x + (screenSize.width / 2 - windowSize[0] / 2),
123+
),
124+
y: Math.floor(
125+
screenSize.y + (screenSize.height - windowSize[1]) / 3,
126+
),
127+
},
120128
};
121129

122130
// Default to right if the window is bigger than the space left.

src/Concerns/HasPositioner.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,9 @@ public function center(): self
8787
{
8888
return $this->windowPosition('center');
8989
}
90+
91+
public function upperCenter(): self
92+
{
93+
return $this->windowPosition('upperCenter');
94+
}
9095
}

0 commit comments

Comments
 (0)