mirror of
https://github.com/kunkundi/crossdesk.git
synced 2026-10-18 09:53:05 +08:00
[fix] sync DeskHub previews with tile size and unify tooltips
This commit is contained in:
@@ -311,6 +311,8 @@ export component MainWindow inherits Window {
|
||||
in property <bool> gallery-controlling: false;
|
||||
out property <float> gallery-video-width: gallery.video-width;
|
||||
out property <float> gallery-video-height: gallery.video-height;
|
||||
out property <float> gallery-preview-width: gallery.preview-width;
|
||||
out property <float> gallery-preview-height: gallery.preview-height;
|
||||
callback gallery-pointer(PointerEventButton, PointerEventKind, length, length);
|
||||
callback gallery-scroll(length, length, length, length);
|
||||
callback gallery-key(string, bool, bool, bool, bool, bool);
|
||||
@@ -531,13 +533,6 @@ export component MainWindow inherits Window {
|
||||
private property <bool> recent-tooltip-online: false;
|
||||
private property <length> recent-tooltip-pointer-x: 0px;
|
||||
private property <length> recent-tooltip-pointer-y: 0px;
|
||||
private property <length> recent-tooltip-width: 260px;
|
||||
private property <length> recent-tooltip-x: min(
|
||||
root.width - root.recent-tooltip-width - 8px,
|
||||
max(8px,
|
||||
root.recent-tooltip-pointer-x > root.width * 0.7
|
||||
? root.recent-tooltip-pointer-x - root.recent-tooltip-width - 12px
|
||||
: root.recent-tooltip-pointer-x + 12px));
|
||||
|
||||
changed menu-open => { if root.menu-open { root.gallery-action("release", ""); } }
|
||||
changed connection-dialog-open => { if root.connection-dialog-open { root.gallery-action("release", ""); } }
|
||||
@@ -1433,16 +1428,25 @@ export component MainWindow inherits Window {
|
||||
}
|
||||
}
|
||||
|
||||
// Match the ImGui recent-connection tooltip while keeping it outside the
|
||||
// clipped ScrollView. It is deliberately limited to the thumbnail area.
|
||||
// Stay under the modal layer (z >= 39): a hover tooltip that outlives the
|
||||
// pointer can otherwise cover a dialog button and hide it from the user.
|
||||
if root.recent-tooltip-visible && !root.connection-dialog-open: Rectangle {
|
||||
x: root.recent-tooltip-x;
|
||||
// Shared device details sit outside the clipped recent list and wall rail,
|
||||
// below the modal layer (z >= 39).
|
||||
if (root.gallery-mode ? gallery.hovered-device.id != "" : root.recent-tooltip-visible)
|
||||
&& !root.connection-dialog-open: device-tip := Rectangle {
|
||||
private property <string> device-name: root.gallery-mode ? gallery.hovered-device.name : root.recent-tooltip-name;
|
||||
private property <string> host-name: root.gallery-mode ? gallery.hovered-device.host-name : root.recent-tooltip-host;
|
||||
private property <string> device-id: root.gallery-mode ? gallery.hovered-device.id : root.recent-tooltip-id;
|
||||
private property <string> group-names: root.gallery-mode ? gallery.hovered-device.group-names : root.recent-tooltip-groups;
|
||||
private property <bool> online: root.gallery-mode ? gallery.hovered-device.online : root.recent-tooltip-online;
|
||||
private property <bool> presence-known: !root.gallery-mode || gallery.hovered-device.presence-known;
|
||||
private property <length> pointer-x: root.gallery-mode ? gallery.x + gallery.device-tooltip-x : root.recent-tooltip-pointer-x;
|
||||
private property <length> pointer-y: root.gallery-mode ? gallery.y + gallery.device-tooltip-y : root.recent-tooltip-pointer-y;
|
||||
x: min(root.width - self.width - 8px,
|
||||
max(8px, self.pointer-x > root.width * 0.7
|
||||
? self.pointer-x - self.width - 12px : self.pointer-x + 12px));
|
||||
y: min(root.height - root.titlebar-height - self.height - 8px,
|
||||
max(8px, root.recent-tooltip-pointer-y - self.height - 8px));
|
||||
width: root.recent-tooltip-width;
|
||||
height: (root.recent-tooltip-host != "" && root.recent-tooltip-host != root.recent-tooltip-name
|
||||
max(8px, self.pointer-y - self.height - 8px));
|
||||
width: 260px;
|
||||
height: (self.host-name != "" && self.host-name != self.device-name
|
||||
? 80px : 64px) + tooltip-groups.preferred-height + 2px;
|
||||
background: #22252bf2;
|
||||
border-width: 1px;
|
||||
@@ -1454,34 +1458,35 @@ export component MainWindow inherits Window {
|
||||
padding: 8px;
|
||||
spacing: 2px;
|
||||
Text {
|
||||
text: UiStrings.device-name + ": " + root.recent-tooltip-name;
|
||||
text: UiStrings.device-name + ": " + device-tip.device-name;
|
||||
color: white;
|
||||
font-size: ImGuiFontStyle.small;
|
||||
overflow: elide;
|
||||
}
|
||||
if root.recent-tooltip-host != "" && root.recent-tooltip-host != root.recent-tooltip-name: Text {
|
||||
text: root.recent-tooltip-host;
|
||||
if device-tip.host-name != "" && device-tip.host-name != device-tip.device-name: Text {
|
||||
text: device-tip.host-name;
|
||||
color: #e1e4e8;
|
||||
font-size: ImGuiFontStyle.small;
|
||||
overflow: elide;
|
||||
}
|
||||
Text {
|
||||
text: UiStrings.remote-id + ": " + root.recent-tooltip-id;
|
||||
text: UiStrings.remote-id + ": " + device-tip.device-id;
|
||||
color: #e1e4e8;
|
||||
font-size: ImGuiFontStyle.small;
|
||||
overflow: elide;
|
||||
}
|
||||
tooltip-groups := Text {
|
||||
text: GalleryStrings.tr("分组", "Groups", "Группы") + ": " +
|
||||
(root.recent-tooltip-groups == "" ? GalleryStrings.tr("未分组", "Ungrouped", "Без группы") : root.recent-tooltip-groups);
|
||||
(device-tip.group-names == "" ? GalleryStrings.tr("未分组", "Ungrouped", "Без группы") : device-tip.group-names);
|
||||
color: #e1e4e8;
|
||||
font-size: ImGuiFontStyle.small;
|
||||
wrap: word-wrap;
|
||||
vertical-stretch: 0;
|
||||
}
|
||||
Text {
|
||||
text: root.recent-tooltip-online ? UiStrings.online : UiStrings.offline;
|
||||
color: root.recent-tooltip-online ? #62d98b : #d1d5db;
|
||||
text: device-tip.online ? UiStrings.online : device-tip.presence-known ? UiStrings.offline
|
||||
: GalleryStrings.tr("未知", "Unknown", "Неизвестно");
|
||||
color: device-tip.online ? #62d98b : #d1d5db;
|
||||
font-size: ImGuiFontStyle.small;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user