Skip to content

Commit

Permalink
feat(scope):add keyshape.endArrow
Browse files Browse the repository at this point in the history
  • Loading branch information
pomelo-nwu committed Jan 21, 2021
1 parent 8b33ac5 commit 064188d
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions packages/graphin-graphscope/src/graph.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import React, { useState, useEffect } from 'react';
import Graphin, { Behaviors, Utils } from '@antv/graphin';
import { ContextMenu, FishEye, MiniMap } from '@antv/graphin-components';
import { colorSets } from './color';
import { message } from 'antd';
import iconLoader from '@antv/graphin-icons';
import { colorSets } from './color';
import LayoutSelector from './layoutSelector';

const { hexToRgbaToHex } = Utils;

import CustomMenu from './contextmenu';

import iconLoader from '@antv/graphin-icons';
import '@antv/graphin-icons/dist/index.css';

const { hexToRgbaToHex } = Utils;

const icons = Graphin.registerFontFamily(iconLoader);

const { Menu } = ContextMenu;
Expand Down Expand Up @@ -248,9 +248,11 @@ const GraphScope: React.FC<IGraphProps> = ({
size: 0.5,
color: '#AAB7C4', // '#545872',
style: {
endArrow: {
path: 'M 0,0 L 8,4 L 8,-4 Z',
fill: '#545872',
keyshape: {
endArrow: {
path: 'M 0,0 L 8,4 L 8,-4 Z',
fill: '#545872',
},
},
},
};
Expand All @@ -269,7 +271,7 @@ const GraphScope: React.FC<IGraphProps> = ({

useEffect(() => {
const transData = transGraphData(data);
setState(preState => {
setState((preState) => {
return {
...preState,
data: transData,
Expand All @@ -279,23 +281,23 @@ const GraphScope: React.FC<IGraphProps> = ({

const { visible, layout } = state;
const handleClose = () => {
setState(preState => {
setState((preState) => {
return {
...preState,
visible: false,
};
});
};
const handleOpen = () => {
setState(preState => {
setState((preState) => {
return {
...preState,
visible: true,
};
});
};
const handleRefresh = () => {
setState(preState => {
setState((preState) => {
return {
...preState,
data: refreshData,
Expand All @@ -312,8 +314,8 @@ const GraphScope: React.FC<IGraphProps> = ({
};

const handleChangeLayout = (value: string) => {
const currentLayout = layouts.find(item => item.type === value);
setState(preState => {
const currentLayout = layouts.find((item) => item.type === value);
setState((preState) => {
return {
...preState,
layout: currentLayout as any,
Expand All @@ -326,7 +328,7 @@ const GraphScope: React.FC<IGraphProps> = ({
<Graphin graphDOM={graphDOM} data={state.data as any} layout={layout} width={width} height={height}>
<ZoomCanvas enableOptimize />
<DragNode />
{hasMinimap && <MiniMap visible={true} options={{ padding: 20, size: [140, 70] }} />}
{hasMinimap && <MiniMap visible options={{ padding: 20, size: [140, 70] }} />}
<LayoutSelector onChange={handleChangeLayout} value={state.layout.type} options={layouts} />
<ContextMenu style={{ width: 90 }}>
<CustomMenu expandNeighbors={expandNeighbors} />
Expand Down

0 comments on commit 064188d

Please sign in to comment.