Skip to content

Commit 84ab130

Browse files
authored
UI and separation fixes. (#7045)
Signed-off-by: Alexander Platov <alexander.platov@hardcoreeng.com>
1 parent db4e6e1 commit 84ab130

File tree

16 files changed

+222
-196
lines changed

16 files changed

+222
-196
lines changed

packages/theme/styles/components.scss

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@
2323
min-width: 0;
2424
border: 1px solid var(--theme-divider-color); // var(--global-surface-02-BorderColor);
2525
border-radius: var(--small-focus-BorderRadius);
26-
border-bottom-right-radius: 0;
27-
border-top-right-radius: 0;
28-
border-right: 0;
2926

3027
&:not(.modal) {
3128
background-color: var(--theme-panel-color); // var(--global-surface-02-BackgroundColor);

packages/ui/src/components/PanelInstance.svelte

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
props = $panelstore.panel
6565
})
6666
}
67+
$panelstore.panel.refit = fitPopupInstance
6768
} else {
6869
props = undefined
6970
}
@@ -132,6 +133,7 @@
132133
if (!keepSize && props?.element === 'content') {
133134
keepSize = true
134135
resizeObserver(contentPanel, checkResize)
136+
if (!contentPanel.hasAttribute('data-id')) contentPanel.setAttribute('data-id', 'contentPanel')
135137
}
136138
}
137139

packages/ui/src/components/Scroller.svelte

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@
174174
}
175175
}
176176
177-
const handleScroll = (event: MouseEvent): void => {
177+
const handleScroll = (event: PointerEvent): void => {
178178
scrolling = false
179179
if (
180180
(divBar == null && isScrolling === 'vertical') ||
@@ -185,7 +185,7 @@
185185
}
186186
const rectScroll = divScroll.getBoundingClientRect()
187187
if (isScrolling === 'vertical') {
188-
let Y = event.clientY - dXY
188+
let Y = Math.round(event.clientY) - dXY
189189
if (Y < rectScroll.top + shiftTop + 2) Y = rectScroll.top + shiftTop + 2
190190
if (Y > rectScroll.bottom - divBar.clientHeight - shiftBottom - 2) {
191191
Y = rectScroll.bottom - divBar.clientHeight - shiftBottom - 2
@@ -201,7 +201,7 @@
201201
divScroll.scrollTop = (divScroll.scrollHeight - divScroll.clientHeight) * procBar
202202
}
203203
} else if (isScrolling === 'horizontal') {
204-
let X = event.clientX - dXY
204+
let X = Math.round(event.clientX) - dXY
205205
if (X < rectScroll.left + 2 + shiftLeft) X = rectScroll.left + 2 + shiftLeft
206206
if (X > rectScroll.right - divBarH.clientWidth - (mask !== 'none' ? 12 : 2) - shiftRight) {
207207
X = rectScroll.right - divBarH.clientWidth - (mask !== 'none' ? 12 : 2) - shiftRight
@@ -215,18 +215,18 @@
215215
}
216216
}
217217
const onScrollEnd = (): void => {
218-
document.removeEventListener('mousemove', handleScroll)
218+
document.removeEventListener('pointermove', handleScroll)
219219
document.body.style.userSelect = 'auto'
220220
document.body.style.webkitUserSelect = 'auto'
221-
document.removeEventListener('mouseup', onScrollEnd)
221+
document.removeEventListener('pointerup', onScrollEnd)
222222
isScrolling = false
223223
}
224-
const onScrollStart = (event: MouseEvent, direction: 'vertical' | 'horizontal'): void => {
224+
const onScrollStart = (event: PointerEvent, direction: 'vertical' | 'horizontal'): void => {
225225
if (divScroll == null) return
226226
scrolling = false
227-
dXY = direction === 'vertical' ? event.offsetY : event.offsetX
228-
document.addEventListener('mouseup', onScrollEnd)
229-
document.addEventListener('mousemove', handleScroll)
227+
dXY = Math.round(direction === 'vertical' ? event.offsetY : event.offsetX)
228+
document.addEventListener('pointerup', onScrollEnd)
229+
document.addEventListener('pointermove', handleScroll)
230230
document.body.style.userSelect = 'none'
231231
document.body.style.webkitUserSelect = 'none'
232232
isScrolling = direction
@@ -666,10 +666,10 @@
666666
class:hovered={isScrolling === 'vertical'}
667667
class:reverse={scrollDirection === 'vertical-reverse'}
668668
bind:this={divBar}
669-
on:mousedown|stopPropagation={(ev) => {
669+
on:pointerdown|stopPropagation={(ev) => {
670670
onScrollStart(ev, 'vertical')
671671
}}
672-
on:mouseleave={checkFade}
672+
on:pointerleave={checkFade}
673673
/>
674674
{/if}
675675
{#if horizontal && maskH !== 'none'}
@@ -687,10 +687,10 @@
687687
class="bar-horizontal"
688688
class:hovered={isScrolling === 'horizontal'}
689689
bind:this={divBarH}
690-
on:mousedown|stopPropagation={(ev) => {
690+
on:pointerdown|stopPropagation={(ev) => {
691691
onScrollStart(ev, 'horizontal')
692692
}}
693-
on:mouseleave={checkFade}
693+
on:pointerleave={checkFade}
694694
/>
695695
{/if}
696696
</div>
@@ -864,9 +864,11 @@
864864
overscroll-behavior: none;
865865
}
866866
&::-webkit-scrollbar:vertical {
867+
display: none;
867868
width: 0;
868869
}
869870
&::-webkit-scrollbar:horizontal {
871+
display: none;
870872
height: 0;
871873
}
872874

0 commit comments

Comments
 (0)