Skip to content

Moveable + Selecto: Dragging doesn't start sometime! #972

@jadiagaurang

Description

@jadiagaurang

Environments

  • Framework name: Vanilla JS
  • Framework version: N/A
  • Moveable Component version: 0.50.2
  • Testable Address(optional): Have included video

Description

I am facing an issue where dragging doesn't start something on an Element on a Click Event. But able to select and resize the element. The mouse cursor has a "not-allowed" icon as well. I am using Selecto for selection, my config is as follows:

Object Initialization

var objSelecto = new Selecto({
    container: canvasContainer,
    dragContainer: canvasContainer,
    selectableTargets: [".el-wrapper"],
    hitRate: 100,
    selectByClick: true,
    preventClickEventOnDrag: false,  //  Prevent click event on drag. (mousemove, touchmove)
    selectFromInside: false,
    toggleContinueSelect: ["shift"],
    ratio: 0
});

Event Callbacks!

objSelecto
.on("dragStart", function (event) {
    var target = event.inputEvent.target;

    if (
        objMoveable.isMoveableElement(target)
        || targets.some(t => t === target
        || t.contains(target))
        || target.tagName === "BUTTON"
        || target.isContentEditable
    ) {
        event.stop();
    }
})
.on("select", function (event) {
    targets = event.selected;
    objMoveable.target = targets;

    console.log("Active Selected Elements", targets.length);
})
.on("selectEnd", function (event) {
    if (event.isDragStart) {
        event.inputEvent.preventDefault();

        setTimeout(() => {
            objMoveable.dragStart(event.inputEvent);
        });
    }
});

I won't be able to provide a testable link, so I have included a video for you to refer to.

Recording.2023-07-06.124527.mp4

I would appreciate any help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions