import { AimOutlined, CompressOutlined, ExpandOutlined, MinusOutlined, PlusOutlined, QuestionCircleFilled } from "@ant-design/icons"; import { Button, ConfigProvider, Divider, Slider, Tooltip } from "antd"; import React, { useEffect, useRef, useState } from "react"; import { useFullscreen } from "ahooks"; import { useModel } from "umi"; import { MiniMap } from '@antv/x6-plugin-minimap'; import insertCss from 'insert-css'; insertCss(` .navigation-view { position: absolute; bottom: 32px; right: 32px; width: 330px; height: 210px; background-color: #fff; border: 1px solid #e9edf2; border-radius: 8px 8px 0 0; overflow: hidden; z-index: 1; box-shadow: 0 4px 10px 1px rgba(0, 0, 0, .1); }`); export default function Footer() { const [isFullscreen, { toggleFullscreen }] = useFullscreen(document.body); const navigationViewRef = useRef(null); const { graph, selectedCell } = useModel("flowchartModel"); const [showNavigation, setShowNavigation] = useState(false); const [countCell, setCountCell] = useState(0); const [scale, setScale] = useState(100); useEffect(() => { if(!graph || !navigationViewRef.current) return; graph.use( new MiniMap({ container: navigationViewRef.current, width: 330, height: 210, padding: 10, }), ) }, [graph, navigationViewRef.current]); useEffect(() => { graph?.on('cell:change:*', () => { const count = graph?.getCells().length || 0; setCountCell(count > 0 ? count - 1 : 0) }); graph?.on('scale', (scaleInfo) => { setScale(parseInt(scaleInfo.sx * 100 + '')); }) }, [graph]); const handleZoom = (value: number) => { graph?.zoomTo(value / 100) } const handleZoomFit = () => { graph?.zoomToFit({ }) } const handleOnChange = (value: number) => { setScale(Math.round(value)); handleZoom(value) } return (
图形:{selectedCell?.length}/{countCell}
{/*
); }