Changeset 0.37.19 (#232)

Co-authored-by: gobha <jasafpro@gmail.com>
Co-committed-by: gobha <jasafpro@gmail.com>
This commit is contained in:
2026-03-25 00:26:44 +00:00
committed by xcaliber
parent 54ceeb4299
commit be67feaa8e
21 changed files with 173 additions and 88 deletions

View File

@@ -82,7 +82,7 @@ export function SidebarItems({
const _openMenu = useCallback((e, type, item) => {
e.preventDefault();
e.stopPropagation();
const scale = _getScale();
const scale = sw.shell.getScale();
// The dots button may be display:none (zero rect) — fall back to parent
let rect = e.currentTarget.getBoundingClientRect();
if (!rect.width && !rect.height) {
@@ -97,7 +97,7 @@ export function SidebarItems({
const _bodyContextMenu = useCallback((e) => {
if (e.target.closest('.sw-chat-surface__item') || e.target.closest('.sw-chat-surface__folder-header')) return;
e.preventDefault();
const scale = _getScale();
const scale = sw.shell.getScale();
setContextMenu({ type: 'body', item: null, x: e.clientX / scale, y: e.clientY / scale });
}, []);
@@ -356,16 +356,6 @@ function ChannelItem({ channel, activeId, onSelect, onOpenMenu, onDragStart, ind
</button>`;
}
// Read the CSS scale transform on .surface-inner (set by appearance zoom).
// Context menus use position:fixed which breaks under transforms,
// so we divide getBoundingClientRect values by scale to compensate.
function _getScale() {
const el = document.getElementById('surfaceInner');
if (!el) return 1;
const t = getComputedStyle(el).transform;
if (!t || t === 'none') return 1;
const m = t.match(/matrix\(([^,]+)/);
return m ? parseFloat(m[1]) || 1 : 1;
}
// Scale detection moved to sw.shell.getScale() in v0.37.19 (CR P3-3).
// Folder count = direct children only (subfolders + channels in this folder).