Skip to content

Commit

Permalink
feat: ok
Browse files Browse the repository at this point in the history
  • Loading branch information
Anonymity94 committed Mar 18, 2021
1 parent 9c40e05 commit 5acbaee
Show file tree
Hide file tree
Showing 13 changed files with 37 additions and 14 deletions.
4 changes: 3 additions & 1 deletion .umirc.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { defineConfig } from 'umi'

export default defineConfig({
publicPath: './',
routes: [
{ path: '/', component: '@/pages/index' },
{ path: '/apps/draw', component: '@/pages/index' },
],
base: '/x6-graph/',
publicPath: '/x6-graph/',
title: 'x6-graph',
extraBabelPlugins: [
[
'import',
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# x6-graph-draw
# x6-graph

依托 `X6` 图编辑引擎实现网络拓扑

Expand Down
13 changes: 13 additions & 0 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env sh
# 确保脚本抛出遇到的错误
set -e

npm run build
cd dist
git init

git add -A
git commit -m 'deploy'
git push -f [email protected]:Anonymity94/x6-graph.git master:gh-pages

cd -
9 changes: 8 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
{
"private": true,
"name": "@antv/x6-app-draw",
"name": "x6-graph",
"version": "1.1.4",
"scripts": {
"start": "umi dev",
"build": "umi build",
"deploy": "bash deploy.sh",
"lint": "yarn lint:ts",
"lint:ts": "tslint -c tslint.json -p tsconfig.json --fix",
"precommit": "lint-staged"
},
"repository": {
"type": "git",
"url": "[email protected]:Anonymity94/x6-graph.git"
},
"homepage": "http://anonymity94.github.io/x6-graph",
"author": "[email protected]",
"dependencies": {
"@antv/x6": "^1.13.4",
"@antv/x6-react-components": "^1.1.1",
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useEffect, useState } from 'react';
import { Toolbar } from '@antv/x6-react-components';
import FlowGraph from '../../Graph';
import FlowGraph from '../..';
import { DataUri } from '@antv/x6';
import {
ClearOutlined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ export interface TooltipToolOptions extends ToolsView.ToolItem.Options {

class TooltipTool extends ToolsView.ToolItem<EdgeView, TooltipToolOptions> {
private delay = 100;
private timer: number;
private timer: number = 0;
// @ts-ignore
private knob: HTMLDivElement;
private tooltipVisible: boolean;
private tooltipVisible: boolean = false;

render() {
super.render();
Expand Down
6 changes: 3 additions & 3 deletions src/pages/Graph/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import pcIcon from './icons/pc.png';
import routerIcon from './icons/router.png';
import serverIcon from './icons/server.png';
import switchIcon from './icons/switch.png';
import TooltipTool from '../components/TooltipTool';
import TooltipTool from './components/TooltipTool';
import './shape';

import styles from './style.less';
Expand Down Expand Up @@ -396,12 +396,12 @@ export default class FlowGraph {
this.showPorts(ports, false);
});

graph.on('node:collapse', ({ node, e }) => {
graph.on('node:collapse', ({ node, e }: any) => {
e.stopPropagation();
node.toggleCollapse();
const collapsed = node.isCollapsed();
const cells = node.getDescendants();
cells.forEach((n) => {
cells.forEach((n: any) => {
if (collapsed) {
n.hide();
} else {
Expand Down
10 changes: 5 additions & 5 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React, { useState, useEffect } from 'react';
import { GithubOutlined } from '@ant-design/icons';
import React, { useEffect, useState } from 'react';
import FlowGraph from './Graph';
import ToolBar from './components/ToolBar';
import ConfigPanel from './components/ConfigPanel';
import '../reset.less';
import ConfigPanel from './Graph/components/ConfigPanel';
import ToolBar from './Graph/components/ToolBar';

import '../global.css';
import '../reset.less';
import styles from './index.less';

export default function () {
Expand Down

0 comments on commit 5acbaee

Please sign in to comment.