-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reordering bugs #74
Comments
I can confirm that after a while the demo freezes, unfreezes, freezes again.. when dragging a tab around, which is strange (is that a new bug? nobody else sees that?) |
I'm starting to understand where this bug is coming from. It's actually two bugs I believe the freezing/unfreezing is coming from having to render the Second bug: there's an issue where sometimes you try to drag a tab, it appears away from the cursor and you're dragging it with an offset far away from the actual cursor position. To reproduce this:
You can get the same effect going in the right direction with a left-center offset. In fact, you can even correct the bad offset by "balancing" it out like this. My theory is something bad is happening with the handleDragStop event |
I think we may see a clue in the handleDragStart event. If you add a third parameter, you'll get a react-draggable
i.e.
It seems |
It looks like there's a series of things happening here... handleDrag: EventHandler<MouseEvent> = (e) => {
// Get the current drag point from the event. This is used as the offset.
const position = getControlPosition(e, this.state.touchIdentifier, this);
if (position == null) return;
let {x, y} = position; This leads us to // Get {x, y} positions from event.
export function getControlPosition(e: MouseEvent, touchIdentifier: ?number, draggableCore: DraggableCore): ?ControlPosition {
const touchObj = typeof touchIdentifier === 'number' ? getTouch(e, touchIdentifier) : null;
if (typeof touchIdentifier === 'number' && !touchObj) return null; // not the right touch
const node = ReactDOM.findDOMNode(draggableCore);
// User can provide an offsetParent if desired.
const offsetParent = draggableCore.props.offsetParent || node.offsetParent || node.ownerDocument.body;
return offsetXYFromParent(touchObj || e, offsetParent);
} export function offsetXYFromParent(evt: {clientX: number, clientY: number}, offsetParent: HTMLElement): ControlPosition {
const isBody = offsetParent === offsetParent.ownerDocument.body;
const offsetParentRect = isBody ? {left: 0, top: 0} : offsetParent.getBoundingClientRect();
const x = evt.clientX + offsetParent.scrollLeft - offsetParentRect.left;
const y = evt.clientY + offsetParent.scrollTop - offsetParentRect.top;
return {x, y};
} I think our only options are one of the following:
Thoughts? |
Thanks your investigation! Bug2: Can we override with this file? |
It's on my list. I'll be working on this eventually |
Was the inclusion of CustomDraggable supposed to fix the offset problem? I still have an offset problem after about 5 tab position changes. |
Awesome library, thanks.
I find very quickly in the online demo that reordering tabs is buggy.
Try your demo, reorder a few tabs, select them, reorder again, you should see the problem quickly, resize window etc.
Also for some reason it was becoming very slow at times like there is a tight code loop.
I can trigger this quite easily but can't tell you specific sequence to replicate it.
The text was updated successfully, but these errors were encountered: