Questions tagged [snap-to-grid]

This tag should be used for questions referring to drawing applications, where there is a grid in the background, and objects are automatically aligned with the grid lines when they are dropped on the grid.

What questions should have this tag?

Any questions referring to situations where you have an underlying grid in the background (visible or invisible) and the object that is being drawn, dragged, or positioned on the grid will be automatically aligned with the grid lines.

Some basic definitions

  • Drawn: an object is created on the grid using a vector tool
  • Positioned: an object is placed on the grid
  • Dragged: an object is dragged to the grid using a drag-and-drop tool
  • Object: any shape or image or line that can be dragged, drawn, or positioned on the grid

About snap to grid

Snap to grid is a function where objects are automatically aligned with the grid lines when they are dropped on the grid.

Learn more

11 questions
3
votes
1 answer

Snapping to grid in JavaScript

I'm looking for a javascript function that calculates a snap to grid value using a uniformly spaced grid. Now I have the following code, which works fine as a basic solution, but now I need it to snap only when within say 2px of the snap position…
Steve
  • 3,483
  • 5
  • 21
  • 20
1
vote
1 answer

Python: How to make drawn elements snap to grid in pygame

I am experimenting with a Pathfinding project and got stuck while creating a working GUI. I'm using pygame and already created a grid and a feature, which draws cubes when you press (or keep pressing) the mouse-button. However, these cubes just go…
CrazyPhil
  • 73
  • 6
1
vote
1 answer

JQuery or canvas layout tool (snap to grid)

I'm trying to implement some kind of drag and drop snap to grid similar to something like this http://wordsquared.com/. Was contemplating trying to use JQuery UI and somehow save the position of the items. Seems like snapping to a grid, and saving…
user379468
  • 3,989
  • 10
  • 50
  • 68
1
vote
2 answers

onclick clone() a draggable at x&y=0 of the containment to avoid any offset

I'm trying to do something similar to this jsFiddle but instead of dropping manually the widget on the containment I would like to click the widget and the widget goes automatically on the x=0 and y=0 of the containment. And of course then be able…
user9080416
1
vote
3 answers

How to snap to grid in StarUML?

I'm using StarUML to make some diagrams and have the grid enabled but I can't find any option to make objects snap to grid... Does anyone have a solution? Thank you
franzbischoff
  • 150
  • 5
  • 15
1
vote
1 answer

How to disable "snap to grid" from jQuery UI draggable?

Anyone know how we can disable "Snap to Grid" from jQuery UI Draggable base on checkbox. I m using below code to enable snap to grid dynamically. $(".WidgetCl").draggable({containment: '#editorWindow',scroll: true, snap: ".gridCol", snapMode:…
Sonal Khunt
  • 1,876
  • 12
  • 20
0
votes
1 answer

Run the "Clean Up" Right-Click Menu Action Using Shell Script

all. Using a shell script that can be triggered how I wish (BetterTouchTool), I want to run the "Clean Up" option from context menu that appears when I right-click on an empty space on the desktop. This simply rearranges all desktop icons so they…
Yovah
  • 1
  • 2
0
votes
1 answer

Grid functionality - Gridpane or custom?

I wish to create a grid where you can place elements on who will snap to grid. The grid would consist of 25x25 px cells and could potentially be 1000x1000 cells large. I would have to be able to individually access all cells and be able to turn off…
Limnic
  • 1,826
  • 1
  • 20
  • 45
0
votes
0 answers

QGraphicsGrid implementing Drag and Drop / Snap-to functionality

This is a follow-up question of Making an editable flowchart in Qt/C++. I want to add a QGraphicsItem to a QGraphicsGridLayout in a way that the item takes up its own spot in the grid and then automatically centers in its 'cell'. I am using…
mhag
  • 85
  • 2
  • 6
0
votes
4 answers

How to know where mouse will be prior to MouseMove

I am trying to implement a functionality in my application to snap cursor to edge of a grid in my scene. As it stands I do have the framework to take the current MouseMove provided e.Location and converting to my world coordinates and back to screen…
Bob2u
  • 135
  • 2
  • 10
-1
votes
2 answers

How do you implement a snap-to-grid in QGraphicsScene? Mine didn't work

I don't have any code to show because this was over a year ago. I used a timer I think. It did not work very professionally. How would you do it so that it is a smooth operator? I am already able to draw the grid efficiently (ie. in view only). …
MathCrackExchange
  • 595
  • 1
  • 6
  • 25