-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
181 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import * as React from 'react'; | ||
|
||
interface ILockProps { | ||
fill?: string; | ||
} | ||
|
||
const Lock: React.FunctionComponent<ILockProps> = props => { | ||
const { fill = '#000' } = props; | ||
return ( | ||
<svg width="14px" height="14px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 25 32"> | ||
<path | ||
d="M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z" | ||
fill={fill} | ||
></path> | ||
</svg> | ||
); | ||
}; | ||
|
||
export default Lock; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import * as React from 'react'; | ||
|
||
interface IUnlockProps { | ||
fill?: string; | ||
} | ||
|
||
const Unlock: React.FunctionComponent<IUnlockProps> = props => { | ||
const { fill = '#000' } = props; | ||
return ( | ||
<svg width="14px" height="14px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 25 32"> | ||
<path | ||
d="M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z" | ||
fill={fill} | ||
></path> | ||
</svg> | ||
); | ||
}; | ||
|
||
export default Unlock; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 4 additions & 3 deletions
7
packages/studio-importor/src/app/button-controller/right-button.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
packages/studio-importor/src/app/graph-canvas/CustomControls.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import React from 'react'; | ||
import { Button, Flex, Divider } from 'antd'; | ||
import { PlusOutlined, MinusOutlined, ExpandOutlined } from '@ant-design/icons'; | ||
import { useReactFlow, Panel } from 'reactflow'; | ||
import { Icons, useThemeContainer } from '@graphscope/studio-components'; | ||
|
||
interface ICustomControlsProps { | ||
isLocked: boolean; | ||
handleLocked: (val: boolean) => void; | ||
} | ||
const CustomControls: React.FunctionComponent<ICustomControlsProps> = props => { | ||
const { isLocked, handleLocked } = props; | ||
const { zoomIn, zoomOut, fitView } = useReactFlow(); | ||
const { algorithm } = useThemeContainer(); | ||
const isDark = algorithm === 'darkAlgorithm'; | ||
// svg path fill | ||
const fill = isDark ? '#FFF' : '#000'; | ||
// lock or unlock | ||
const Icon = isLocked ? <Icons.Lock fill={fill} /> : <Icons.Unlock fill={fill} />; | ||
const background = isDark ? '#1d1d1d' : '#fff'; | ||
return ( | ||
<> | ||
<Panel | ||
position="bottom-left" | ||
style={{ | ||
boxShadow: | ||
'0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 9px 28px 8px rgba(0, 0, 0, 0.05)', | ||
background, | ||
}} | ||
> | ||
<Flex vertical> | ||
<Button | ||
style={{ borderRadius: 0 }} | ||
size="small" | ||
type="text" | ||
icon={<PlusOutlined />} | ||
onClick={() => zoomIn({ duration: 100 })} | ||
/> | ||
<Divider style={{ margin: 0 }} /> | ||
<Button | ||
style={{ borderRadius: 0 }} | ||
size="small" | ||
type="text" | ||
icon={<MinusOutlined />} | ||
onClick={() => zoomOut({ duration: 100 })} | ||
/> | ||
<Divider style={{ margin: 0 }} /> | ||
<Button | ||
style={{ borderRadius: 0 }} | ||
size="small" | ||
type="text" | ||
icon={<ExpandOutlined />} | ||
onClick={() => fitView()} | ||
/> | ||
<Divider style={{ margin: 0 }} /> | ||
<Button | ||
style={{ borderRadius: 0 }} | ||
size="small" | ||
type="text" | ||
icon={Icon} | ||
onClick={() => { | ||
handleLocked(!isLocked); | ||
}} | ||
/> | ||
</Flex> | ||
</Panel> | ||
</> | ||
); | ||
}; | ||
|
||
export default CustomControls; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.