update 0.6.0
This commit is contained in:
		| @@ -2,7 +2,7 @@ | ||||
|  * @Author: yehuozhili | ||||
|  * @Date: 2021-02-21 22:17:29 | ||||
|  * @LastEditors: yehuozhili | ||||
|  * @LastEditTime: 2021-07-19 10:11:14 | ||||
|  * @LastEditTime: 2021-07-20 11:33:12 | ||||
|  * @FilePath: \dooringx\packages\dooringx-lib\src\components\IframeWrapperMove\event.ts | ||||
|  */ | ||||
| import { RefObject } from 'react'; | ||||
| @@ -35,7 +35,6 @@ export const wrapperRefState: WrapperMoveRef = { | ||||
| }; | ||||
|  | ||||
| export const wrapperEvent = (ref: RefObject<HTMLDivElement>, config: UserConfig) => { | ||||
| 	const scale = config.getScaleState().value; | ||||
| 	const store = config.getStore(); | ||||
| 	return { | ||||
| 		onMouseDown: (e: React.MouseEvent) => { | ||||
| @@ -57,8 +56,8 @@ export const wrapperEvent = (ref: RefObject<HTMLDivElement>, config: UserConfig) | ||||
| 			if (wrapperMoveState.isDrag) { | ||||
| 				const diffX = e.clientX - wrapperMoveState.startX; | ||||
| 				const diffY = e.clientY - wrapperMoveState.startY; | ||||
| 				wrapperMoveState.needX = wrapperMoveState.needX + diffX / scale; | ||||
| 				wrapperMoveState.needY = wrapperMoveState.needY + diffY / scale; | ||||
| 				wrapperMoveState.needX = wrapperMoveState.needX + diffX; | ||||
| 				wrapperMoveState.needY = wrapperMoveState.needY + diffY; | ||||
| 				wrapperMoveState.startX = e.clientX; | ||||
| 				wrapperMoveState.startY = e.clientY; | ||||
|  | ||||
|   | ||||
| @@ -2,7 +2,7 @@ | ||||
|  * @Author: yehuozhili | ||||
|  * @Date: 2021-03-14 04:29:09 | ||||
|  * @LastEditors: yehuozhili | ||||
|  * @LastEditTime: 2021-07-17 22:13:37 | ||||
|  * @LastEditTime: 2021-07-20 11:24:39 | ||||
|  * @FilePath: \dooringx\packages\dooringx-lib\src\components\IframeWrapperMove\index.tsx | ||||
|  */ | ||||
| import { AllHTMLAttributes, CSSProperties, PropsWithChildren, ReactNode, useRef } from 'react'; | ||||
| @@ -11,7 +11,6 @@ import { onWheelEvent } from '../../core/scale'; | ||||
| import React from 'react'; | ||||
| import Ticker from './ticker'; | ||||
| import UserConfig from '../../config'; | ||||
| import { containerResizer } from '../../core/resizeHandler/containerResizer'; | ||||
|  | ||||
| export interface ContainerWrapperProps extends AllHTMLAttributes<HTMLDivElement> { | ||||
| 	config: UserConfig; | ||||
| @@ -42,6 +41,7 @@ function ContainerWrapper(props: PropsWithChildren<ContainerWrapperProps>) { | ||||
| 				flexDirection: 'column', | ||||
| 				position: 'relative', | ||||
| 				overflow: 'hidden', | ||||
| 				userSelect: 'none', | ||||
| 				...style, | ||||
| 			}} | ||||
| 			{...wrapperEvent(ref, props.config)} | ||||
| @@ -51,32 +51,12 @@ function ContainerWrapper(props: PropsWithChildren<ContainerWrapperProps>) { | ||||
| 			<div | ||||
| 				style={{ | ||||
| 					position: 'absolute', | ||||
| 					transform: `scale(${scaleState.value}) translate(${wrapperMoveState.needX}px, ${wrapperMoveState.needY}px)`, | ||||
| 					transform: `translate(${wrapperMoveState.needX}px, ${wrapperMoveState.needY}px)`, | ||||
| 					width: state.container.width * scaleState.value, | ||||
| 					height: state.container.height * scaleState.value, | ||||
| 				}} | ||||
| 			> | ||||
| 				{children} | ||||
|  | ||||
| 				<div | ||||
| 					style={{ | ||||
| 						height: '50px', | ||||
| 						display: 'flex', | ||||
| 						justifyContent: 'center', | ||||
| 						alignItems: 'center', | ||||
| 						width: state.container.width * scaleState.value, | ||||
| 					}} | ||||
| 				> | ||||
| 					<div | ||||
| 						style={{ | ||||
| 							fontSize: '20px', | ||||
| 							cursor: 's-resize', | ||||
| 						}} | ||||
| 						onMouseDown={(e) => containerResizer.onMousedown(e, props.config)} | ||||
| 					> | ||||
| 						{props.config.getConfig().containerIcon} | ||||
| 					</div> | ||||
| 				</div> | ||||
| 			</div> | ||||
| 			{extra && extra} | ||||
| 			{ticker && <Ticker config={props.config}></Ticker>} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 hufeixiong
					hufeixiong