question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Snapgrid vertical/horizontal guidelines relative to a specific container

See original GitHub issue

Environments

  • Framework name: React
  • Framework version: Latest
  • Moveable Component version: Latest
  • Testable Address(optional):

Description

Hello, I’m looking for a way to pass a list of vertical and horizontal guidelines using the snappable able, but make the guidelines relative to the container of the element or a user-specified container. Would it be possible to include a prop like the following:

guidelinesContainer: (selected: (HTMLElement | SVGElement)[]) => HTMLElement

Return value of this would be the container that the guidelines are relative to.

This way when I pass guidelines to verticalGuidelines and horizontalGuidelines, the values can depend on a container other than the container of the react-moveable instance.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
nelsondudecommented, Nov 20, 2020

On second thought, I’m thinking a better way for this would be when passing in verticalGuidelines/horizontalGuidelines, the prop would have the following typing:

type verticalGuidelines = number[] | {container: HTMLElement, value: number}[] type horizontalGuidelines = number[] | {container: HTMLElement, value: number}[]

This would allow the user to specify the guideline relative to a particular container before hand. My use case is that I have a single moveable instance managing the components on multiple “pages” but these pages can be zoomed in and out. Since the moveable instance currently lives outside of the pages, the vertical guidelines have to be changed every time the zoom of the page is changed

0reactions
nelsondudecommented, Dec 15, 2020

No problem, i think this should help me accomplish what I was trying to do. Thanks! works great.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Practical CSS Scroll Snapping
CSS scroll snapping allows you to lock the viewport to certain elements or ... First, we tell the container to snap along its...
Read more >
Grid, Guides, and Smart Snapping in Godot 3 (tutorial)
Get a comprehensive overview of Godot's grids and snapping options!Intermediate Godot 3 course: ...
Read more >
How to snap shapes positions on dragging with Konva?
How to snap draggable shapes to each other?This demo will demonstrate how to implement snapping of objects to all edges of the stage...
Read more >
Set up Snap Grid | User Guide Page - Graphisoft Help Center
Use the controls under Snap Grid/Nudge to define the intervals (horizontal and vertical directions) to which the cursor will snap when Snap Grid...
Read more >
FlexContainer
Specifies whether the arrangement of widgets in the FlexContainer flows horizontally, vertically, or in both directions. Default: Vertical. Child Widget Align.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found