meshedit-modal.vue 5.46 KB
<template>
    <section class="meshedit">
        <div class="meshedit-types">
            <span
                :class="selecteditem.key === item.key ? 'item selected' : 'item'"
                v-for="item in items"
                :key="item.key"
                @click="onSelect(item.key)"
            >
                <img :src="item.image" />
                <div class="text" v-text="$t(item.key)" />
            </span>
        </div>
        <div class="adjustment">
            <div class="size-input">
                <div class="value">
                    <span>{{ selecteditem.size }} mm</span>
                </div>
                <div class="input">
                    <span class="type-text">{{ $t('brushSize') }}</span>
                    <el-slider
                        v-model="selecteditem.size"
                        :min="1"
                        :max="3"
                        :step="0.01"
                        :show-tooltip="false"
                        @input="onChangeSize"
                    />
                </div>
            </div>
            <div class="intensity-input">
                <div class="input">
                    <span class="type-text"> {{ $t('brushStrength') }}</span>
                    <el-slider
                        v-model="selecteditem.intensity"
                        :min="3"
                        :max="8"
                        :step="0.01"
                        :show-tooltip="false"
                        @input="onChangeIntensity"
                    />
                </div>
            </div>
        </div>
    </section>
</template>
<script setup>
import { useMeshEditStore } from '@/views/stores/funtional-toolbar/useMeshEditStore';
import { storeToRefs } from 'pinia';

const store = useMeshEditStore();
const { items, selecteditem } = storeToRefs(store);
const { setSelectedItem, changeSize, changeIntensity } = store;

const onSelect = (key) => {
    setSelectedItem(key);
};

const onChangeSize = (val) => {
    changeSize(val);
};

const onChangeIntensity = (val) => {
    changeIntensity(val);
};
</script>
<style lang="less" scoped>
.meshedit {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin: 11px 0;
    .meshedit-types {
        display: flex;
        flex-direction: row;
        -webkit-box-pack: justify;
        justify-content: space-between;
        gap: 4px;
        .item {
            box-sizing: border-box;
            display: flex;
            cursor: pointer;
            background-color: #ffffff;
            padding: 8px 11px;
            border: 1px solid #cdd1d5;
            border-radius: 8px;
            border-image: initial;
            display: flex;
            flex-direction: column;
            width: 70px;
            img {
                width: 28px;
                height: 28px;
                margin: auto;
                display: block;
            }
            .text {
                width: max-content;
                padding-top: 5px;
                margin: 0px;
                font-size: 14px;
                line-height: 22px;
                font-weight: 500;
                color: #333333;
                margin: auto;
                display: block;
                font-weight: 600;
            }
            &.selected {
                background-color: @color-button-selected-background;
                border-color: @color-button-main-selected-border;
            }
            &:hover {
                background-color: @color-button-hover-background;
            }
        }
    }
    .button-big {
        display: flex;
        width: 100%;
        -webkit-box-pack: center;
        justify-content: center;
        -webkit-box-align: center;
        align-items: center;
        padding: 0px;
        height: 46px;
        border-radius: 8px;
        cursor: pointer;
        margin: 0px;
        font-size: 14px;
        line-height: 20px;
        font-weight: 600;
        margin-top: 12px;
    }
    .adjustment {
        display: flex;
        flex-direction: column;
        gap: 10px;
        margin-top: 10px;
        .el-slider {
            width: 161px !important;
            height: 22px !important;
        }
        & span {
            margin: 0px;
            visibility: inherit;
            font-size: 13px;
            font-weight: 500;
            line-height: 12px;
        }
        .size-input {
            .value {
                display: flex;
                flex-direction: column;
                align-items: flex-end;
            }
            .input {
                width: 100%;
                display: flex;
                -webkit-box-pack: justify;
                justify-content: space-between;
                height: 22px;
                .type-text {
                    margin: 0px;
                    font-size: 14px;
                    line-height: 22px;
                    font-weight: 600;
                }
            }
        }
        .intensity-input {
            width: 100%;
            display: flex;
            -webkit-box-pack: justify;
            justify-content: space-between;
            .input {
                width: 100%;
                display: flex;
                -webkit-box-pack: justify;
                justify-content: space-between;
                height: 22px;
                .type-text {
                    margin: 0px;
                    font-size: 14px;
                    line-height: 22px;
                    font-weight: 600;
                }
            }
        }
    }
}
</style>