GithubHelp home page GithubHelp logo

Comments (5)

stoddabr avatar stoddabr commented on June 19, 2024

I found a resolution by calculating the bounding box of the parent.
This was done by changing lines ~125-130 of collection.js in function createNipple :

    var zone = self.options.zone;
    var parentRect = zone.getBoundingClientRect();
    console.log(parentRect.top, parentRect.right, parentRect.bottom, parentRect.left);

    if (position.x && position.y) {
        toPutOn = {
            x: parentRect.left + position.x -
                (scroll.x + self.box.left),
            y: parentRect.top + position.y -
                (scroll.y + self.box.top)
        };

Before I go through the effort of making a pull request, I just want to check in with people who know this project better than me to make sure this is a sensible solution that won't cause weird edgecases. I don't really understand the expected behavior or when position.x and position.y will be falsy so I don't know if parentRect.left & parentRect.left should be added in the other cases as well.

Here's a repl of the full code with changes working as expected: https://svelte.dev/repl/bbd65fbe0e5b4898a291e924dfb51db0?version=3.46.4

from nipplejs.

yoannmoinet avatar yoannmoinet commented on June 19, 2024

Thanks for the details and the repro!
The issue with your solution is that we're computing and using parent's position twice (see parentRect.top and self.box.top).

I think everything resides on how the position of the zone is computed by the browser, due to display: flex.
Basically, if you removes the + self.box.top and + self.box.left from the initial code, you'd fix the issue in your context.

But, we have to understand why it's doing that when using display: flex.

I'm checking a bit more.

from nipplejs.

yoannmoinet avatar yoannmoinet commented on June 19, 2024

Created #182, let me know if that fixes your issue.

from nipplejs.

yoannmoinet avatar yoannmoinet commented on June 19, 2024

Released in v0.9.1

from nipplejs.

dellwatson avatar dellwatson commented on June 19, 2024

this still doesnt solve the problem unfortunately

from nipplejs.

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.