Giter Site home page Giter Site logo

Comments (5)

pakastin avatar pakastin commented on July 29, 2024

I think you could just substract scrollTop and scrollLeft from e.pageX and e.pageY here: https://github.com/pakastin/nodegarden/blob/master/scripts/index.js

I get back to this after new year.. Happy 2018!

from nodegarden.

Chillstice avatar Chillstice commented on July 29, 2024

I haven't been able to get that solution to work. I imagine it's an easy fix, but I can't figure it out. Here's my example: https://chillstice.com

from nodegarden.

pakastin avatar pakastin commented on July 29, 2024

Should work now after a big update..?

from nodegarden.

pakastin avatar pakastin commented on July 29, 2024

Fixed it with window.scrollX and window.scrollY:

$container.addEventListener('click', (e) => {
const bcr = $container.getBoundingClientRect();
const scrollPos = {
x: window.scrollX,
y: window.scrollY
};
resetNode++;
if (resetNode > nodeGarden.nodes.length - 1) {
resetNode = 1;
}
nodeGarden.nodes[resetNode].reset({
x: (e.pageX - scrollPos.x - bcr.left) * pixelRatio,
y: (e.pageY - scrollPos.y - bcr.top) * pixelRatio,
vx: 0,
vy: 0
});
});

from nodegarden.

Chillstice avatar Chillstice commented on July 29, 2024

That solved it

from nodegarden.

Related Issues (6)

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.