<template>
    <component v-if="!asChild" :is="as" :class="cx('root')" :type="as === 'BUTTON' ? 'button' : undefined" :disabled="!zoomed || undefined" data-action="zoom-out" @click="onClick" v-bind="ptmi('root')">
        <slot />
    </component>
    <slot v-else :class="cx('root')" :onClick="onClick" :disabled="!zoomed" />
</template>

<script>
import BaseGalleryZoomOut from './BaseGalleryZoomOut.vue';

export default {
    name: 'GalleryZoomOut',
    extends: BaseGalleryZoomOut,
    inheritAttrs: false,
    inject: ['$pcGallery'],
    methods: {
        onClick() {
            this.$pcGallery?.onClickAction('zoomOut');
        }
    },
    computed: {
        zoomed() {
            return this.$pcGallery?.activeItemTransform?.zoomed ?? false;
        }
    }
};
</script>
