@@ -6,7 +6,7 @@ import ResizableRect from 'react-resizable-rotatable-draggable';
66import RadioBlocks from '../widgets/RadioBlocks' ;
77import DualNumeric from './DualNumeric' ;
88
9- const maxWidth = 286 ;
9+ const maxWidth = 276 ;
1010const gridRes = 8 ;
1111
1212class UnconnectedRectanglePositioner extends Component {
@@ -77,94 +77,96 @@ class UnconnectedRectanglePositioner extends Component {
7777 }
7878
7979 return (
80- < Field { ...this . props } attr = { attr } >
81- < Field label = { _ ( 'Snap to Grid' ) } >
82- < RadioBlocks
83- alignment = "center"
84- onOptionChange = { snap => this . setState ( { snap : snap } ) }
85- activeOption = { this . state . snap }
86- options = { [ { label : _ ( 'On' ) , value : true } , { label : _ ( 'Off' ) , value : false } ] }
87- />
88- </ Field >
89- < div
90- className = "rect-container"
91- style = { {
92- width : fieldWidthPx + 1 ,
93- height : fieldHeightPx + 1 ,
94- } }
95- >
96- { Array ( gridRes * gridRes )
97- . fill ( 0 )
98- . map ( ( v , i ) => (
99- < div
100- key = { i }
101- className = "rect-grid"
102- style = { {
103- width : fieldWidthPx / gridRes - 1 ,
104- height : fieldHeightPx / gridRes - 1 ,
105- borderBottom : i < gridRes * ( gridRes - 1 ) ? '0' : '1px solid ' ,
106- borderRight : ( i + 1 ) % gridRes ? '0' : '1px solid' ,
107- } }
108- />
109- ) ) }
110- < ResizableRect
111- bounds = "parent"
112- width = { width }
113- height = { height }
114- left = { left }
115- top = { top }
116- rotatable = { false }
117- draggable = { ! this . state . snap }
118- zoomable = { zoomable }
119- onResize = { style => {
120- this . sendUpdate ( {
121- fieldWidthPx,
122- fieldHeightPx,
123- width : style . width ,
124- height : style . height ,
125- x : style . left ,
126- y : style . top ,
127- } ) ;
128- } }
129- onDrag = { ( deltaX , deltaY ) => {
130- this . sendUpdate ( {
131- fieldWidthPx,
132- fieldHeightPx,
133- width,
134- height,
135- x : left + deltaX ,
136- y : top + deltaY ,
137- } ) ;
80+ < div style = { { marginRight : 25 } } >
81+ < Field { ...this . props } attr = { attr } >
82+ < Field label = { _ ( 'Snap to Grid' ) } >
83+ < RadioBlocks
84+ alignment = "center"
85+ onOptionChange = { snap => this . setState ( { snap : snap } ) }
86+ activeOption = { this . state . snap }
87+ options = { [ { label : _ ( 'On' ) , value : true } , { label : _ ( 'Off' ) , value : false } ] }
88+ />
89+ </ Field >
90+ < div
91+ className = "rect-container"
92+ style = { {
93+ width : fieldWidthPx + 1 ,
94+ height : fieldHeightPx + 1 ,
13895 } }
139- />
140- </ div >
141- { fullContainer . xaxis && fullContainer . xaxis . overlaying ? (
142- ''
143- ) : (
144- < DualNumeric
145- label = { _ ( 'X' ) }
146- attr = { this . attr . x [ 0 ] }
147- attr2 = { this . attr . x [ 1 ] }
148- percentage
149- step = { 1 }
150- min = { 0 }
151- max = { 100 }
152- />
153- ) }
154- { fullContainer . yaxis && fullContainer . yaxis . overlaying ? (
155- ''
156- ) : (
157- < DualNumeric
158- label = { _ ( 'Y' ) }
159- attr = { this . attr . y [ 0 ] }
160- attr2 = { this . attr . y [ 1 ] }
161- percentage
162- step = { 1 }
163- min = { 0 }
164- max = { 100 }
165- />
166- ) }
167- </ Field >
96+ >
97+ { Array ( gridRes * gridRes )
98+ . fill ( 0 )
99+ . map ( ( v , i ) => (
100+ < div
101+ key = { i }
102+ className = "rect-grid"
103+ style = { {
104+ width : fieldWidthPx / gridRes - 1 ,
105+ height : fieldHeightPx / gridRes - 1 ,
106+ borderBottom : i < gridRes * ( gridRes - 1 ) ? '0' : '1px solid ' ,
107+ borderRight : ( i + 1 ) % gridRes ? '0' : '1px solid' ,
108+ } }
109+ />
110+ ) ) }
111+ < ResizableRect
112+ bounds = "parent"
113+ width = { width }
114+ height = { height }
115+ left = { left }
116+ top = { top }
117+ rotatable = { false }
118+ draggable = { ! this . state . snap }
119+ zoomable = { zoomable }
120+ onResize = { style => {
121+ this . sendUpdate ( {
122+ fieldWidthPx,
123+ fieldHeightPx,
124+ width : style . width ,
125+ height : style . height ,
126+ x : style . left ,
127+ y : style . top ,
128+ } ) ;
129+ } }
130+ onDrag = { ( deltaX , deltaY ) => {
131+ this . sendUpdate ( {
132+ fieldWidthPx,
133+ fieldHeightPx,
134+ width,
135+ height,
136+ x : left + deltaX ,
137+ y : top + deltaY ,
138+ } ) ;
139+ } }
140+ />
141+ </ div >
142+ { fullContainer . xaxis && fullContainer . xaxis . overlaying ? (
143+ ''
144+ ) : (
145+ < DualNumeric
146+ label = { _ ( 'X' ) }
147+ attr = { this . attr . x [ 0 ] }
148+ attr2 = { this . attr . x [ 1 ] }
149+ percentage
150+ step = { 1 }
151+ min = { 0 }
152+ max = { 100 }
153+ />
154+ ) }
155+ { fullContainer . yaxis && fullContainer . yaxis . overlaying ? (
156+ ''
157+ ) : (
158+ < DualNumeric
159+ label = { _ ( 'Y' ) }
160+ attr = { this . attr . y [ 0 ] }
161+ attr2 = { this . attr . y [ 1 ] }
162+ percentage
163+ step = { 1 }
164+ min = { 0 }
165+ max = { 100 }
166+ />
167+ ) }
168+ </ Field >
169+ </ div >
168170 ) ;
169171 }
170172}
0 commit comments