import { ModuleView } from '@/hook/render/yosys';
import { reactive } from 'vue';

export const treeviewData = reactive({
    /**
     * @description 当前的顶层模块数量，内部数据结构是递归的
     * 大部分情况下，它应该是只有一个元素
     * 
     * @type {ModuleView[]}
     */
    modules: []
});

export const verticalResizer = reactive({
    height: 500,
    active: false,
    hover: false,
    mousedown() {
        this.active = true;
        document.addEventListener('mousemove', resize);
    }
});

export function resize(event) {
    verticalResizer.height = event.clientY;
}