You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey, thanks for making this great project! I had to customize it slightly for my own use case. Just letting you see what I did in case you're interested in incorporating this upstream.
Changes made:
Existing option to use an arbitrary HTMLElement as DragBounds doesn't appear to be documented, so I added that
Add function as input type for DragBounds. This is because the variable bound to an HTMLElement will be undefineduntil the component mounts, and therefore cannot be passed in directly to neodrag at component mount time
Allow for custom render function. I have multiple elements that must be moved at the same time, that are already positioned using the left attribute. I'd rather keep the existing CSS instead of moving to transform, and I also need to coordinate changing the positioning for multiple elements simultaneously with no lag
Allow for custom inverseScale. I am using the skew transform on my element, which results in an inverseScale of about 0.84. Since I am using a controlled element, I would need to apply the inverse of this scaling when programmatically controlling the element. Instead of doing that, it's simpler for me to just work in regular pixel units and disable the scaling calculations altogether.
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
This PR includes no changesets
When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types
Why render method? If its for applying any and all changes, transform can do that. Rather than returning values you can directly mutate the node(node.style.left = offsetX), and return null
inverseScale can again be implemented within transform
Other than that, does keeping bounds not a function cause errors? Even if its null in the beginning, it can be populated when the bound element is mounted
Good point, I think you're right. I need to modify more than one node at a time, so applying styles to the dragged node itself is insufficient. But I can do the same thing I'm doing inside of the transform function instead, so long as I avoid returning a string.
I don't think inverseScale can be applied within transform because the computation happens before transform is called, and information about the original values is lost.
Good point, I'll have to actually try this out with onMount instead, but I think you're right
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hey, thanks for making this great project! I had to customize it slightly for my own use case. Just letting you see what I did in case you're interested in incorporating this upstream.
Changes made:
HTMLElementasDragBoundsdoesn't appear to be documented, so I added thatDragBounds. This is because the variable bound to anHTMLElementwill beundefineduntil the component mounts, and therefore cannot be passed in directly to neodrag at component mount timeleftattribute. I'd rather keep the existing CSS instead of moving totransform, and I also need to coordinate changing the positioning for multiple elements simultaneously with no laginverseScale. I am using theskewtransform on my element, which results in an inverseScale of about 0.84. Since I am using a controlled element, I would need to apply the inverse of this scaling when programmatically controlling the element. Instead of doing that, it's simpler for me to just work in regular pixel units and disable the scaling calculations altogether.