Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Add a condition to only activate the resizer which belongs to the clicked handle #7055

Merged
merged 1 commit into from
Nov 2, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/resizer/resizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,14 @@ export default class Resizer<C extends IConfig = IConfig> {
// child dom nodes that can be the target
const resizeHandle = event.target && (<HTMLDivElement>event.target).closest(`.${this.classNames.handle}`);
const hasHandler = this?.config?.handler;
if (!resizeHandle || (!hasHandler && resizeHandle.parentElement !== this.container)) {
// prevent that stacked resizer's are both activated with one mouse event
// (this is possible because the mouse events are connected to the containers not the handles)
if (!resizeHandle || // if no resizeHandle exist / mouse event hit the container not the handle
(!hasHandler && resizeHandle.parentElement !== this.container) || // no handler from config -> check if the containers match
(hasHandler && resizeHandle !== hasHandler)) { // handler from config -> check if the handlers match
return;
}

// prevent starting a drag operation
event.preventDefault();

Expand Down