fix(ags player): make my own func to get overlays because native one doesnt work
This commit is contained in:
parent
a24736ea1c
commit
69090fa7c5
2 changed files with 9 additions and 6 deletions
|
@ -23,13 +23,14 @@ export default ({ properties, connections, params } = {}) => {
|
||||||
...connections,
|
...connections,
|
||||||
|
|
||||||
[gesture, overlay => {
|
[gesture, overlay => {
|
||||||
if (overlay.overlays.length <= 1)
|
if (overlay.list().length <= 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
overlay._dragging = true;
|
overlay._dragging = true;
|
||||||
const offset = gesture.get_offset()[1];
|
const offset = gesture.get_offset()[1];
|
||||||
|
|
||||||
let playerBox = overlay.get_children().at(-1);
|
let playerBox = overlay.list().at(-1);
|
||||||
|
|
||||||
if (offset >= 0) {
|
if (offset >= 0) {
|
||||||
playerBox.setStyle(`margin-left: ${offset}px;
|
playerBox.setStyle(`margin-left: ${offset}px;
|
||||||
margin-right: -${offset}px;
|
margin-right: -${offset}px;
|
||||||
|
@ -45,13 +46,13 @@ export default ({ properties, connections, params } = {}) => {
|
||||||
}, 'drag-update'],
|
}, 'drag-update'],
|
||||||
|
|
||||||
[gesture, overlay => {
|
[gesture, overlay => {
|
||||||
if (overlay.overlays.length <= 1)
|
if (overlay.list().length <= 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
overlay._dragging = false;
|
overlay._dragging = false;
|
||||||
const offset = gesture.get_offset()[1];
|
const offset = gesture.get_offset()[1];
|
||||||
|
|
||||||
let playerBox = overlay.get_children().at(-1);
|
let playerBox = overlay.list().at(-1);
|
||||||
|
|
||||||
if (Math.abs(offset) > MAX_OFFSET) {
|
if (Math.abs(offset) > MAX_OFFSET) {
|
||||||
if (offset >= 0) {
|
if (offset >= 0) {
|
||||||
|
@ -71,7 +72,7 @@ export default ({ properties, connections, params } = {}) => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
overlay.reorder_overlay(playerBox, 0);
|
overlay.reorder_overlay(playerBox, 0);
|
||||||
playerBox.setStyle(playerBox._bgStyle);
|
playerBox.setStyle(playerBox._bgStyle);
|
||||||
overlay._selected = overlay.get_children().at(-1);
|
overlay._selected = overlay.list().at(-1);
|
||||||
}, 500);
|
}, 500);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -80,5 +81,7 @@ export default ({ properties, connections, params } = {}) => {
|
||||||
}, 'drag-end'],
|
}, 'drag-end'],
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
widget.child.list = () => widget.child.get_children().filter(ch => ch._bgStyle !== undefined);
|
||||||
|
|
||||||
return widget;
|
return widget;
|
||||||
};
|
};
|
||||||
|
|
|
@ -93,7 +93,7 @@ export const PlayerIcon = (player, { symbolic = true, ...params } = {}) => {
|
||||||
return Box({
|
return Box({
|
||||||
connections: [
|
connections: [
|
||||||
[Mpris, box => {
|
[Mpris, box => {
|
||||||
let overlays = box.get_parent().get_parent().get_parent().overlays;
|
let overlays = box.get_parent().get_parent().get_parent().list();
|
||||||
let player = overlays.find(overlay => overlay === box.get_parent().get_parent());
|
let player = overlays.find(overlay => overlay === box.get_parent().get_parent());
|
||||||
let index = overlays.indexOf(player)
|
let index = overlays.indexOf(player)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue