Skip to content

Commit 73334b8

Browse files
Merge pull request #36 from metalabdesign/fix-things
Remove rotation and edge detection.
2 parents b83af4a + c246c2c commit 73334b8

1 file changed

Lines changed: 1 addition & 47 deletions

File tree

src/flowtip.js

Lines changed: 1 addition & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export default class Flowtip extends Component {
7575
}
7676

7777
availableAndFitsIn([region, ...regions], regionParameter) {
78-
if (!regions || regions.length <= 0) {
78+
if (!region) {
7979
return this.props.region;
8080
}
8181

@@ -352,52 +352,6 @@ export default class Flowtip extends Component {
352352
], regionParameter);
353353
}
354354

355-
// Edge detection - squeeze
356-
if (
357-
(region === 'top' || region === 'bottom') &&
358-
!regionParameter.top.fits && !regionParameter.bottom.fits
359-
) {
360-
region = this.availableAndFitsIn(['left', 'right'], regionParameter);
361-
} else if (
362-
(region === 'left' || region === 'right') &&
363-
!regionParameter.left.fits && !regionParameter.right.fits
364-
) {
365-
region = this.availableAndFitsIn(['top', 'bottom'], regionParameter);
366-
}
367-
368-
// Edge detection - rotate
369-
let rotation;
370-
if (region === 'top' || region === 'bottom') {
371-
if (
372-
(parent.left + parent.width) -
373-
(target.left + (target.width / 2)) - this.props.edgeOffset <
374-
this.props.rotationOffset
375-
) {
376-
rotation = region === 'top' ? ['left', 'bottom'] : ['left', 'top'];
377-
} else if (
378-
target.left + (target.width / 2) - this.props.edgeOffset <
379-
parent.left + this.props.rotationOffset
380-
) {
381-
rotation = region === 'top' ? ['right', 'bottom'] : ['right', 'top'];
382-
}
383-
} else if (region === 'left' || region === 'right') {
384-
if (
385-
(parent.top + parent.height) - (target.top + (target.height / 2)) -
386-
this.props.edgeOffset < this.props.rotationOffset
387-
) {
388-
rotation = region === 'left' ? ['top', 'right'] : ['top', 'left'];
389-
} else if (
390-
target.top + (target.height / 2) - this.props.edgeOffset <
391-
parent.top + this.props.rotationOffset
392-
) {
393-
rotation = region === 'left' ? ['bottom', 'right'] : ['bottom', 'left'];
394-
}
395-
}
396-
397-
if (rotation) {
398-
region = this.availableAndFitsIn(rotation, regionParameter);
399-
}
400-
401355
return region;
402356
}
403357

0 commit comments

Comments
 (0)