Skip to content

Commit

Permalink
[IMP] figure: add snap to figure drag & drop
Browse files Browse the repository at this point in the history
With this commit, when moving/resizing a figure with the mouse the figure
will try to snap to other visible figures. This make it easy to align
figures together.

This is done in `figure.ts`. Where we added helpers to first drag the
figure, then helpers to snap the dragged figure.

"Snap lines" will be displayed to the user to visually see where the
snap is happening.

Odoo task 2907730

closes #1737

Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
  • Loading branch information
hokolomopo authored and LucasLefevre committed Mar 20, 2023
1 parent 7cbde52 commit c55d601
Show file tree
Hide file tree
Showing 22 changed files with 1,068 additions and 235 deletions.
2 changes: 1 addition & 1 deletion src/components/figures/figure/figure.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ css/*SCSS*/ `
box-sizing: content-box;
.o-fig-anchor {
z-index: ${ComponentsImportance.ChartAnchor};
z-index: ${ComponentsImportance.FigureAnchor};
position: absolute;
width: ${ANCHOR_SIZE}px;
height: ${ANCHOR_SIZE}px;
Expand Down
1 change: 1 addition & 0 deletions src/components/figures/figure/figure.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
t-on-contextmenu.prevent.stop="onContextMenu"
t-ref="figure"
t-att-style="props.style"
t-att-data-id="props.figure.id"
tabindex="0"
t-on-keydown="(ev) => this.onKeyDown(ev)"
t-on-keyup.stop="">
Expand Down
Loading

0 comments on commit c55d601

Please sign in to comment.