update 0.11.3

This commit is contained in:
hufeixiong
2022-01-04 12:15:09 +08:00
parent e95eadcc5e
commit 143dceb690
13 changed files with 79 additions and 10 deletions

View File

@@ -1,3 +1,9 @@
## 0.11.3
增加旋转回正功能。
优化鼠标样式。
## 0.11.2 ## 0.11.2
优化拖拽速度 优化拖拽速度

View File

@@ -5,6 +5,9 @@ nav:
title: change log title: change log
order: 6 order: 6
--- ---
## 0.11.3
Add rotation return function.
Optimize mouse style.
## 0.11.2 ## 0.11.2
Optimize drag speed Optimize drag speed
## 0.11.1 ## 0.11.1

View File

@@ -5,6 +5,12 @@ nav:
title: 变更日志 title: 变更日志
order: 6 order: 6
--- ---
## 0.11.3
增加旋转回正功能。
优化鼠标样式。
## 0.11.2 ## 0.11.2
优化拖拽速度 优化拖拽速度

View File

@@ -1,5 +1,5 @@
{ {
"version": "0.11.2", "version": "0.11.3",
"license": "MIT", "license": "MIT",
"main": "dist/index.js", "main": "dist/index.js",
"module": "dist/dooringx-lib.esm.js", "module": "dist/dooringx-lib.esm.js",
@@ -50,5 +50,9 @@
"react-color": "^2.19.3", "react-color": "^2.19.3",
"react-intl": "^5.20.10", "react-intl": "^5.20.10",
"react-sortable-hoc": "^2.0.0" "react-sortable-hoc": "^2.0.0"
} },
"repository": {
"type": "git",
"url": "git+https://github.com/H5-Dooring/dooringx.git"
}
} }

View File

@@ -7,7 +7,7 @@ import React from 'react';
import { transfer } from '../core/transfer'; import { transfer } from '../core/transfer';
import { UserConfig } from '../config'; import { UserConfig } from '../config';
import styles from '../index.less'; import styles from '../index.less';
import { RotateResizer } from '../core/rotateHandler'; import { RotateReset, RotateResizer } from '../core/rotateHandler';
interface BlockProps { interface BlockProps {
data: IBlockType; data: IBlockType;
context: 'edit' | 'preview'; context: 'edit' | 'preview';
@@ -185,6 +185,7 @@ function Blocks(props: PropsWithChildren<BlockProps>) {
)} )}
<BlockResizer data={props.data} config={props.config} rect={ref}></BlockResizer> <BlockResizer data={props.data} config={props.config} rect={ref}></BlockResizer>
<RotateResizer data={props.data} config={props.config} rect={ref}></RotateResizer> <RotateResizer data={props.data} config={props.config} rect={ref}></RotateResizer>
<RotateReset data={props.data} config={props.config} rect={ref}></RotateReset>
</div> </div>
); );
} else { } else {

View File

@@ -60,6 +60,7 @@ function Container(props: PropsWithChildren<ContainerProps>) {
backgroundColor: bgColor(), backgroundColor: bgColor(),
position: 'relative', position: 'relative',
overflow: 'hidden', overflow: 'hidden',
cursor: 'default',
...editContainerStyle, ...editContainerStyle,
}} }}
{...(props.context === 'edit' ? containerDragResolve(props.config) : null)} {...(props.context === 'edit' ? containerDragResolve(props.config) : null)}

View File

@@ -64,7 +64,6 @@ export const wrapperEvent = (ref: RefObject<HTMLDivElement>, config: UserConfig)
}; };
export const wrapperMoveMouseUp = (config: UserConfig) => { export const wrapperMoveMouseUp = (config: UserConfig) => {
if (wrapperMoveState.ref && wrapperMoveState.ref.current) { if (wrapperMoveState.ref && wrapperMoveState.ref.current) {
wrapperMoveState.ref.current.style.cursor = 'default';
} }
containerResizer.onMouseUp(config); containerResizer.onMouseUp(config);
wrapperMoveState.isDrag = false; wrapperMoveState.isDrag = false;

View File

@@ -12,6 +12,7 @@ import React from 'react';
import Ticker from './ticker'; import Ticker from './ticker';
import UserConfig from '../../config'; import UserConfig from '../../config';
import TimeLine from '../timeLine/timeline'; import TimeLine from '../timeLine/timeline';
import styles from '../../index.less';
export interface ContainerWrapperProps extends AllHTMLAttributes<HTMLDivElement> { export interface ContainerWrapperProps extends AllHTMLAttributes<HTMLDivElement> {
config: UserConfig; config: UserConfig;
@@ -25,7 +26,7 @@ function ContainerWrapper(props: PropsWithChildren<ContainerWrapperProps>) {
const ticker = props.config.ticker; const ticker = props.config.ticker;
return ( return (
<div <div
className={`ant-menu ${classNames ? classNames : ''}`} className={`ant-menu ${classNames ? classNames : ''} ${styles.yh_container_wrapper}`}
ref={ref} ref={ref}
style={{ style={{
backgroundColor: '#f0f0f0', backgroundColor: '#f0f0f0',

View File

@@ -143,7 +143,6 @@ export const innerContainerDragUp = function (config: UserConfig) {
wrapperMoveMouseUp(config); wrapperMoveMouseUp(config);
selectRangeMouseUp(e, config); selectRangeMouseUp(e, config);
if (innerDragState.ref && innerDragState.ref.current) { if (innerDragState.ref && innerDragState.ref.current) {
innerDragState.ref.current.style.cursor = 'default';
innerDragState.ref.current.style.willChange = 'auto'; innerDragState.ref.current.style.willChange = 'auto';
} }
resizerMouseUp(config); resizerMouseUp(config);

View File

@@ -8,10 +8,10 @@
import React from 'react'; import React from 'react';
import { RefObject, useMemo } from 'react'; import { RefObject, useMemo } from 'react';
import UserConfig from '../../config'; import UserConfig from '../../config';
import { IBlockType } from '../store/storetype'; import { IBlockType, IStoreData } from '../store/storetype';
import styles from '../../index.less'; import styles from '../../index.less';
import { deepCopy } from '../utils'; import { deepCopy } from '../utils';
import { ReloadOutlined } from '@ant-design/icons'; import { ReloadOutlined, RotateLeftOutlined } from '@ant-design/icons';
interface rotateStateType { interface rotateStateType {
startX: number; startX: number;
@@ -97,6 +97,7 @@ export function RotateResizer(props: RotateResizerProps) {
onMouseDown(e, props.data, props.rect, props.config); onMouseDown(e, props.data, props.rect, props.config);
}} }}
className={styles.rotate} className={styles.rotate}
title={'rotate'}
> >
<ReloadOutlined <ReloadOutlined
style={{ style={{
@@ -112,3 +113,37 @@ export function RotateResizer(props: RotateResizerProps) {
return <>{render}</>; return <>{render}</>;
} }
const resetResolve = (e: React.MouseEvent, item: IBlockType, config: UserConfig) => {
e.stopPropagation();
const store = config.getStore();
const clonedata: IStoreData = deepCopy(store.getData());
clonedata.block.forEach((v) => {
if (v.id === item.id) {
v.rotate.value = 0;
}
});
store.setData(clonedata);
};
export function RotateReset(props: RotateResizerProps) {
const render = useMemo(() => {
if (props.data.focus && props.data.rotate.canRotate && props.data.canDrag) {
return (
<div
onMouseDown={(e) => {
resetResolve(e, props.data, props.config);
}}
className={styles.rotatereset}
title={'rotate reset'}
>
<RotateLeftOutlined />
</div>
);
} else {
return null;
}
}, [props.config, props.data]);
return <>{render}</>;
}

View File

@@ -72,6 +72,7 @@
} }
.yh_block_focus { .yh_block_focus {
cursor: move;
&::before { &::before {
position: absolute; position: absolute;
top: -3px; top: -3px;
@@ -203,3 +204,16 @@
cursor: grab; cursor: grab;
font-size: 20px; font-size: 20px;
} }
.rotatereset {
position: absolute;
top: -35px;
left: calc(100% - 15px);
cursor: pointer;
font-size: 20px;
color: gray;
}
.yh_container_wrapper {
&:hover {
cursor: grab;
}
}

View File

@@ -1,6 +1,6 @@
{ {
"name": "dooringx-plugin-template", "name": "dooringx-plugin-template",
"version": "0.11.2", "version": "0.11.3",
"description": "> TODO: description", "description": "> TODO: description",
"author": "yehuozhili <673632758@qq.com>", "author": "yehuozhili <673632758@qq.com>",
"homepage": "https://github.com/H5-Dooring/dooringx#readme", "homepage": "https://github.com/H5-Dooring/dooringx#readme",

View File

@@ -40,7 +40,7 @@
"@rollup/plugin-node-resolve": "^13.0.4", "@rollup/plugin-node-resolve": "^13.0.4",
"@rollup/plugin-url": "^6.1.0", "@rollup/plugin-url": "^6.1.0",
"@svgr/rollup": "^5.5.0", "@svgr/rollup": "^5.5.0",
"dooringx-lib": "^0.11.2", "dooringx-lib": "^0.11.3",
"postcss": "^8.3.6", "postcss": "^8.3.6",
"rollup-plugin-peer-deps-external": "^2.2.4", "rollup-plugin-peer-deps-external": "^2.2.4",
"rollup-plugin-postcss": "^4.0.1", "rollup-plugin-postcss": "^4.0.1",