Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 4be487f

Browse files
committed
Support '%'for width and height
1 parent 29cc3ed commit 4be487f

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

‎example/src/example.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ export default class Example extends Component {
1717
<ResizableAndMovable
1818
x={this.state.x}
1919
y={this.state.y}
20-
width={200}
21-
height={200}
20+
width={'50%'}
21+
height={'50%'}
2222
style={style}
2323
minWidth={200}
2424
minHeight={200}
25-
maxWidth={300}
25+
maxWidth={1000}
2626
maxHeight={300}
2727
onResizeStart={(dir, e) => console.log('resize start')}
2828
onResize={(dir, size, rect) => console.log(size)}

‎src/index.js‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ export default class ResizableAndMovable extends Component {
150150
}
151151

152152
onDrag(e, ui) {
153-
console.dir(ui)
154153
if (this.isResizing) return;
155154
this.setState({ x: ui.position.left, y: ui.position.top });
156155
this.props.onDrag(e, ui);
@@ -185,11 +184,11 @@ export default class ResizableAndMovable extends Component {
185184
>
186185
<div
187186
style={{
188-
width: `${width}px`,
189-
height: `${height}px`,
187+
width,
188+
height,
190189
cursor: 'move',
191190
position: 'absolute',
192-
zIndex: `${zIndex}`,
191+
zIndex,
193192
}}
194193
>
195194
<Resizable
@@ -200,8 +199,8 @@ export default class ResizableAndMovable extends Component {
200199
onResizeStart={this.onResizeStart}
201200
onResize={this.onResize}
202201
onResizeStop={this.onResizeStop}
203-
width={width}
204-
height={height}
202+
width="100%"
203+
height="100%"
205204
minWidth={minWidth}
206205
minHeight={minHeight}
207206
maxWidth={maxWidth}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /