update
This commit is contained in:
@@ -3,3 +3,43 @@ title: 右键菜单
|
|||||||
sTitle: dooringx-lib插件开发
|
sTitle: dooringx-lib插件开发
|
||||||
order: 15
|
order: 15
|
||||||
---
|
---
|
||||||
|
|
||||||
|
右键菜单可以进行自定义:
|
||||||
|
|
||||||
|
```js
|
||||||
|
// 自定义右键
|
||||||
|
const contextMenuState = config.getContextMenuState();
|
||||||
|
const unmountContextMenu = contextMenuState.unmountContextMenu;
|
||||||
|
const commander = config.getCommanderRegister();
|
||||||
|
const ContextMenu = () => {
|
||||||
|
const handleclick = () => {
|
||||||
|
unmountContextMenu();
|
||||||
|
};
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
left: contextMenuState.left,
|
||||||
|
top: contextMenuState.top,
|
||||||
|
position: 'fixed',
|
||||||
|
background: 'rgb(24, 23, 23)',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
style={{ width: '100%' }}
|
||||||
|
onClick={() => {
|
||||||
|
commander.exec('redo');
|
||||||
|
handleclick();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Button>自定义</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
contextMenuState.contextMenu = <ContextMenu></ContextMenu>;
|
||||||
|
```
|
||||||
|
先拿到contextMenuState,contextMenuState上有个unmountContextMenu是关闭右键菜单方法。
|
||||||
|
|
||||||
|
所以在点击后需要调用关闭。
|
||||||
|
|
||||||
|
同时上面的left和top是右键的位置。
|
@@ -2,7 +2,7 @@
|
|||||||
* @Author: yehuozhili
|
* @Author: yehuozhili
|
||||||
* @Date: 2021-01-31 20:44:16
|
* @Date: 2021-01-31 20:44:16
|
||||||
* @LastEditors: yehuozhili
|
* @LastEditors: yehuozhili
|
||||||
* @LastEditTime: 2021-07-11 13:35:16
|
* @LastEditTime: 2021-07-11 23:11:14
|
||||||
* @FilePath: \dooringx\packages\dooringx-lib\README.md
|
* @FilePath: \dooringx\packages\dooringx-lib\README.md
|
||||||
-->
|
-->
|
||||||
|
|
||||||
@@ -16,3 +16,10 @@
|
|||||||
- 0.1.6 调整初始缩放,画布初始比例,增加回正画布功能。
|
- 0.1.6 调整初始缩放,画布初始比例,增加回正画布功能。
|
||||||
- 0.1.5 删除未作按钮,增加fixed配置
|
- 0.1.5 删除未作按钮,增加fixed配置
|
||||||
- 0.1.4 基础功能
|
- 0.1.4 基础功能
|
||||||
|
|
||||||
|
|
||||||
|
## todo
|
||||||
|
|
||||||
|
1、制作标尺
|
||||||
|
2、重构命令,传递config。
|
||||||
|
3、重构拖拽,优化性能与config传递。
|
Reference in New Issue
Block a user