This repository was archived by the owner on Oct 16, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 6 files changed +23
-19
lines changed
examples/react/release/boxes Expand file tree Collapse file tree 6 files changed +23
-19
lines changed Original file line number Diff line number Diff line change 1515 "react-dom" : " ^17.0.2" ,
1616 "react-draggable" : " ^4.4.3" ,
1717 "react-feather" : " ^2.0.9" ,
18- "react-resizable" : " ^3.0.4 " ,
18+ "react-resizable" : " ^1.11.1 " ,
1919 "react-router-dom" : " ^5.2.0" ,
2020 "react-scripts" : " 4.0.3" ,
2121 "typescript" : " ^4.1.2" ,
Original file line number Diff line number Diff line change @@ -41,7 +41,6 @@ export const Rectangle: React.FC<RectangleProps> = (props) => {
4141 position = { element . style . position }
4242 size = { element . style . size }
4343 onResize = { ( style : ElementStyleInterface ) => {
44- console . log ( 'onResize' , style ) ; // TODO REMOVE
4544 ELEMENT ?. patch ( { style : style } ) ;
4645 } }
4746 lockAspectRatio = { element . image !== undefined } >
Original file line number Diff line number Diff line change @@ -21,7 +21,9 @@ const Handle: React.FC<HandlePropsInterface> = (props) => {
2121
2222 const size = 10 ;
2323 const position : Position = { } ;
24+ let cursor = 'default' ;
2425
26+ // Calculate handle position
2527 if ( handleAxis . startsWith ( 'n' ) ) position . top = 0 ;
2628 if ( handleAxis . startsWith ( 's' ) ) position . bottom = 0 ;
2729 if ( handleAxis . includes ( 'w' ) ) position . left = 0 ;
@@ -30,11 +32,12 @@ const Handle: React.FC<HandlePropsInterface> = (props) => {
3032 if ( handleAxis === 'n' || handleAxis === 's' ) position . left = '50%' ;
3133 if ( handleAxis === 'e' || handleAxis === 'w' ) position . top = '50%' ;
3234
33- let cursor = `${ handleAxis } -resize` ;
35+ cursor = `${ handleAxis } -resize` ;
3436 if ( handleAxis === 'n' || handleAxis === 's' ) cursor = 'ns-resize' ;
3537
3638 return (
3739 < Box
40+ className = { `handle-${ handleAxis } ` }
3841 ref = { innerRef }
3942 position = "absolute"
4043 style = { {
Original file line number Diff line number Diff line change @@ -30,19 +30,11 @@ export const Resize: React.FC<ResizePropsInterface> = (props) => {
3030 lockAspectRatio,
3131 } = props ;
3232
33- // https://github.com/react-grid-layout/react-resizable#custom-react-component
34- // https://github.com/react-grid-layout/react-resizable#functional-components
35- const WrappedHandle = React . forwardRef ( ( props : any , ref ) => (
36- < Handle innerRef = { ref } { ...props } />
37- ) ) ;
38-
3933 return (
4034 < Resizable
4135 width = { size . width }
4236 height = { size . height }
4337 onResize = { ( _ , { size : newSize , handle } ) => {
44- console . log ( 'onResize' , size ) ;
45-
4638 let topDiff = 0 ;
4739 if ( handle . includes ( 'n' ) ) {
4840 topDiff = size . height - newSize . height ;
@@ -66,7 +58,15 @@ export const Resize: React.FC<ResizePropsInterface> = (props) => {
6658 } }
6759 resizeHandles = { handlePlacements }
6860 // The handle (dot) to resize the Component
69- handle = { < WrappedHandle visible = { selected } /> }
61+ // TODO Make this work in the latest 'react-resizeable' version.. (-> upgrade from 1.x to 3.x)
62+ // handle={(handleAxis: ResizeHandleType, ref: any) => (
63+ // <Handle handleAxis={handleAxis} innerRef={ref} visible={selected} />
64+ // )}
65+ handle = { ( handleAxis : ResizeHandleType ) => (
66+ < div >
67+ < Handle handleAxis = { handleAxis } visible = { selected } />
68+ </ div >
69+ ) }
7070 lockAspectRatio = { lockAspectRatio } >
7171 < div > { children } </ div >
7272 </ Resizable >
Original file line number Diff line number Diff line change @@ -6,8 +6,10 @@ import App from './App';
66import './global.css' ;
77
88ReactDOM . render (
9- < ChakraProvider >
10- < App />
11- </ ChakraProvider > ,
9+ < React . StrictMode >
10+ < ChakraProvider >
11+ < App />
12+ </ ChakraProvider > { ' ' }
13+ </ React . StrictMode > ,
1214 document . getElementById ( 'root' )
1315) ;
Original file line number Diff line number Diff line change @@ -9878,10 +9878,10 @@ react-remove-scroll@2.4.1:
98789878 use-callback-ref "^1.2.3"
98799879 use-sidecar "^1.0.1"
98809880
9881- react-resizable@^3.0.4 :
9882- version "3.0.4 "
9883- resolved "https://registry.yarnpkg.com/react-resizable/-/react-resizable-3.0.4 .tgz#aa20108eff28c52c6fddaa49abfbef8abf5e581b "
9884- integrity sha512-StnwmiESiamNzdRHbSSvA65b0ZQJ7eVQpPusrSmcpyGKzC0gojhtO62xxH6YOBmepk9dQTBi9yxidL3W4s3EBA ==
9881+ react-resizable@^1.11.1 :
9882+ version "1.11.1 "
9883+ resolved "https://registry.yarnpkg.com/react-resizable/-/react-resizable-1.11.1 .tgz#02ca6850afa7a22c1b3e623e64aef71ee252af69 "
9884+ integrity sha512-S70gbLaAYqjuAd49utRHibtHLrHXInh7GuOR+6OO6RO6uleQfuBnWmZjRABfqNEx3C3Z6VPLg0/0uOYFrkfu9Q ==
98859885 dependencies:
98869886 prop-types "15.x"
98879887 react-draggable "^4.0.3"
You can’t perform that action at this time.
0 commit comments