Coder Social home page Coder Social logo

Comments (2)

craigmjohnston avatar craigmjohnston commented on May 23, 2024

After some more testing, if the entity drops because you've moved too fast, and then you keep the mouse button held and move back over the entity, it'll get picked up again.

It seems like dragTargetEntity is getting set to null (or not getting set, I haven't really fully gone through how Entity.Update() does everything, so I'm not sure).

Maybe the solution is to just have a flag like isBeingDragged and set it when the drag test succeeds initially, then unset it only when the mouse is released

EDIT: It looks like it checks for dragging in this:

// set mouse state
if (IsInsideEntity(mousePos)) {
    // set self as the current target, unless a sibling got the event first
    if (targetEntity == null || targetEntity._parent != _parent) {
        targetEntity = this;
    }

    // set self as the dragging target, but only if draggable or interactive
    if (_draggable || IsNaturallyInteractable()) {
        dragTargetEntity = this;
    }

    // mouse is over entity
    _isMouseOver = true;

    // update mouse state
    _entityState = (IsFocused || PromiscuousClicksMode) && input.MouseButtonDown() ? EntityState.MouseDown : EntityState.MouseHover;
}

Which would mean if the mouse moves outside of the entity it won't register as being dragged any more.

from geonbit.ui.

RonenNess avatar RonenNess commented on May 23, 2024

Merged fix into dev.
Thanks!

from geonbit.ui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.