import type { ButtonConfig } from '../../../../index.type';
import type { BimEngine } from '../../../../../../bim-engine';

/**
 * 拾取面剖切按钮配置
 */
export const createSectionPlaneButton = (engine: BimEngine): ButtonConfig => {
    return {
        id: 'section-plane',
        groupId: 'group-1',
        parentId: 'section',
        type: 'button',
        keepActive: true,
        exclusive: true,
        align: 'vertical',
        label: 'toolbar.sectionPlane',
        icon: '<svg width="32" height="32" viewBox="0 0 24 24"><circle cx="12" cy="12" r="6" fill="currentColor"/></svg>',
        onClick: (button) => {
            console.log('拾取面剖切被点击:', button.id, '激活状态:', button.isActive);
            if (button.isActive) {
                // 激活时显示弹窗
                engine.sectionPlane?.show();
            } else {
                // 关闭时隐藏弹窗
                engine.sectionPlane?.hide();
            }
        }
    };
};
