Skip to content

[215_6] fix image resize logic for top handlers (ne/nw)#2864

Merged
da-liii merged 3 commits intoMoganLab:mainfrom
git-lakshy:myb2
Feb 26, 2026
Merged

[215_6] fix image resize logic for top handlers (ne/nw)#2864
da-liii merged 3 commits intoMoganLab:mainfrom
git-lakshy:myb2

Conversation

@git-lakshy
Copy link
Copy Markdown
Contributor

@git-lakshy git-lakshy commented Feb 25, 2026

fixes issue #2863

Issue

When dragging the top resize handles (ne, nw, n) of an image upwards,
the image would incorrectly expand instead of shrinking.

How to Test

Paste an Image and drag top left (nw) or top right (ne) corner to resize image:

Old effect : Extend on dragging in to shrink

Fixed effect : Shrink on dragging 'ne'/'nw' in and extend on dragging 'ne'/'nw' out

What

To fix, replaced nh with (+ oh sy) in TeXmacs/progs/generic/format-geometry-edit.scm:

;; BEFORE
((ne) (uniform-scale (/ (+ ow sx) ow) (/ nh oh)))
((nw) (uniform-scale (/ nw ow) (/ nh oh)))
((n)  (when (> nh 0.1) (tree-set! t 2 (cm->str nh)) (refresh-window)))

;; AFTER
((ne) (uniform-scale (/ (+ ow sx) ow) (/ (+ oh sy) oh)))
((nw) (uniform-scale (/ nw ow) (/ (+ oh sy) oh)))
((n)  (when (> (+ oh sy) 0.1) (tree-set! t 2 (cm->str (+ oh sy))) (refresh-window)))

Because Y increases upwards, stretching an image UP via ne, nw, n results in a positive sy. Therefore, the new height is calculated as :
Current Height + Stretch Height → (oh + sy)

@git-lakshy git-lakshy changed the title wip : fix image resize [215_6] : fix image resize logic for top handlers (ne/nw) Feb 25, 2026
@git-lakshy git-lakshy marked this pull request as ready for review February 25, 2026 21:56
@da-liii da-liii requested a review from AXeonV February 26, 2026 08:43
Copy link
Copy Markdown
Contributor

@da-liii da-liii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@da-liii da-liii changed the title [215_6] : fix image resize logic for top handlers (ne/nw) [215_6] fix image resize logic for top handlers (ne/nw) Feb 26, 2026
@da-liii da-liii merged commit 9144729 into MoganLab:main Feb 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants