Skip to content

Commit

Permalink
TSK-760: Fix scroll issue for mac (#3173)
Browse files Browse the repository at this point in the history
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
  • Loading branch information
haiodo authored May 12, 2023
1 parent cbe0f74 commit dd712fc
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 9 deletions.
17 changes: 14 additions & 3 deletions packages/ui/src/components/Scroller.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -369,8 +369,12 @@
const wheelEvent = (e: WheelEvent) => {
e = e || window.event
const deltaY = e.deltaY
if (deltaY < 0 && autoscroll && scrolling && beforeContent && beforeContent > 0) scrolling = false
else if (deltaY > 0 && autoscroll && !scrolling && belowContent && belowContent <= 10) scrolling = true
if (deltaY < 0 && autoscroll && scrolling && beforeContent && beforeContent > 0) {
scrolling = false
} else if (deltaY > 0 && autoscroll && !scrolling && belowContent && belowContent <= 10) {
scrolling = true
}
scrollY += deltaY
}
let observer: IntersectionObserver
Expand Down Expand Up @@ -478,7 +482,14 @@
// TODO: Workaround: https://front.hc.engineering/workbench/platform/tracker/TSK-760
// In Safari scroll could jump on click, with no particular reason.

if (scrollY !== 0 && Math.abs(newPos - scrollY) > 100 && divScroll !== undefined && isSafari()) {
if (
!scrolling &&
!isScrolling &&
scrollY !== 0 &&
Math.abs(newPos - scrollY) > 100 &&
divScroll !== undefined &&
isSafari()
) {
divScroll.scrollTop = scrollY
}
scrollY = divScroll?.scrollTop ?? 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,13 @@

<Card on:close fullSize label={getEmbeddedLabel('Statistics')} okAction={() => {}} okLabel={getEmbeddedLabel('Ok')}>
{#if data}
{#each Object.entries(data.statistics?.activeSessions) as act}
{act[0]}: {act[1]}
{/each}
<div class="flex-column">
{#each Object.entries(data.statistics?.activeSessions) as act}
<span class="flex-row-center">
{act[0]}: {act[1]}
</span>
{/each}
</div>

<span class="fs-title flex-row-center">
Memory usage: {data.statistics.memoryUsed} / {data.statistics.memoryTotal}
Expand Down
6 changes: 5 additions & 1 deletion plugins/workbench-resources/src/connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,15 @@ export async function connect (title: string): Promise<Client | undefined> {
await setClient(_client)

if (me.role === AccountRole.Owner) {
let ep = endpoint.replace(/^ws/g, 'http')
if (!ep.endsWith('/')) {
ep += '/'
}
setMetadata(ui.metadata.ShowNetwork, (evt: MouseEvent) => {
showPopup(
ServerStatistics,
{
endpoint: endpoint.replace(/^ws/g, 'http') + '/' + token
endpoint: ep + token
},
'top'
)
Expand Down
9 changes: 7 additions & 2 deletions server/ws/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -411,9 +411,14 @@ class TSessionManager implements SessionManager {
workspace,
'hello happen',
service.getUser(),
'binary:',
service.binaryResponseMode,
'compression:',
service.useCompression,
this.workspaces.get(workspace)?.sessions?.size
'workspace users:',
this.workspaces.get(workspace)?.sessions?.size,
'total users:',
this.sessions.size
)
}
const helloResponse: HelloResponse = { id: -1, result: 'hello', binary: service.binaryResponseMode }
Expand Down Expand Up @@ -441,7 +446,7 @@ class TSessionManager implements SessionManager {
ctx,
ws,
resp,
this.sessions.size < 100 ? 10000 : 101,
this.sessions.size < 100 ? 10000 : 1001,
service.binaryResponseMode,
service.useCompression
)
Expand Down

0 comments on commit dd712fc

Please sign in to comment.