MASA.Blazor icon indicating copy to clipboard operation
MASA.Blazor copied to clipboard

MSlideGroup能否支持触摸滚动

Open Yu-Core opened this issue 1 year ago • 1 comments

Is your feature request related to a problem? Please describe. MSlideGroup无法通过触摸滚动,只能通过按钮,对移动端不太友好 MTabs和MChipGroup也受它的影响

Describe the solution you'd like A clear and concise description of what you want to happen.

Describe alternatives you've considered 目前的临时方案是添加了css,更改了OnScrollOffsetChanged方法

.m-slide-group__wrapper {
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    scrollbar-color: rgba(0, 0, 0, 0);
}

    .m-slide-group__wrapper::-webkit-scrollbar {
        display: none;
    }
private async void OnScrollOffsetChanged(double val)
    {
        if (RTL)
        {
            val = -val;
        }

        var scroll = val <= 0
            ? Bias(-val)
            : val > ContentWidth - WrapperWidth
                ? -(ContentWidth - WrapperWidth) + Bias(ContentWidth - WrapperWidth - val)
                : -val;

        if (RTL)
        {
            scroll = -scroll;
        }

        //改动了这里
        if (WrapperRef.Context != null)
        {
            await Js.ScrollTo(WrapperRef, 0, -scroll);
        }
    }

Additional context Vuetify是可以的

Yu-Core avatar Sep 21 '24 17:09 Yu-Core