GithubHelp home page GithubHelp logo

Comments (6)

lafiosca avatar lafiosca commented on August 21, 2024

Let's add the relevant values from that object to each of the dragged and receiver items in the drag events, as required rather than optional, for accuracy/convenience.

The dragged item will now have:

	/** If being dragged or released, the relative offset of the drag point from the view */
	dragOffset: Animated.ValueXY;

	/** If being dragged, the relative offset of where the view was grabbed */
	grabOffset: Position;
	/** If being dragged, the relative offset/dimensions ratio of where the view was grabbed */
	grabOffsetRatio: Position;

	/** The position in screen coordinates of the dragged hover view (dragScreenPosition - grabOffset) */
	hoverPosition: Animated.ValueXY;

Note that we omit dragScreenPosition because it's already in the event data. Also I am uncertain on hoverPosition, although I don't think it hurts to include it, and even if noHover is enabled the value still exists unused.

We've already added the relevant values to the receiver data in #15

from react-native-drax.

lafiosca avatar lafiosca commented on August 21, 2024

I forgot that we can't access the viewState directly in the provider handler methods because we'll end up in a circular dependency. These methods only operate on the registry ref values and update state via dispatch, never depending on reading state. Still, the registry is able to calculate the updated values to dispatch to the updater, so it must be possible to have this information. It just might be awkward with the current logic organization.

from react-native-drax.

lafiosca avatar lafiosca commented on August 21, 2024

But I completely misremembered where this data lives. Yes, it's reflected in the viewState, but some or all of it is also in the registry and accessible (perhaps with some extra convenience methods).

from react-native-drax.

lafiosca avatar lafiosca commented on August 21, 2024

This is definitely a breaking change, as some field names will be changed for consistency as well.

from react-native-drax.

lafiosca avatar lafiosca commented on August 21, 2024

Why are we using Animated.ValueXY for these in the first place? It's harder to access the x/y values from those. We should only be using Animated values when we need to animate them. Currently the only one the library is animating is hoverPosition, which makes sense. (DraxList also uses its own animated shifts internally, but those don't matter for this.)

from react-native-drax.

lafiosca avatar lafiosca commented on August 21, 2024

Forgot to close this issue when it was addressed by PR #18 and released in 0.5.0

from react-native-drax.

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.