<template>
    <v-menu
        v-model="menu.visible"
        :position-x="0.5 * (app.width - width)"
        :position-y="0.5 * (app.height - height)"
        absolute
        offset-y
        :close-on-content-click="false"
        :close-on-click="false"
    >
        <v-card
            tile
            flat
        >
            <curs-open 
                v-if="curs"
                :app="app"
                :curs="curs"
                :width="width"
                :height="height"
            />

            <v-card-actions>
                <v-spacer></v-spacer>
                <cs-btn 
                    caption="Renunță"
                    icon="mdi-close"
                    @click="OnClickCancel"
                />
            </v-card-actions>
        </v-card>
    </v-menu>
</template>

<script>
    export default {
        props: {
            app: {required: true},
            menu: {required: true},
            width: {default: 800},
            height: {default: 600},
        },

        computed: {
            curs() {
                return this.menu.curs;
            }
        },

        methods: {
            OnClickCancel() {
                this.menu.visible = false;
                this.menu.curs = null;
            }
        },

        components: {
            CsBtn: require('@CsVueComp/buttons/CsBtn').default,
        },

        name: 'CursPreviewMenu'
    }
</script>