From 5af4b69b4313d71b25ff8fbcc4efdfae6a302194 Mon Sep 17 00:00:00 2001 From: Jon Date: Tue, 26 Jul 2022 17:38:04 +0200 Subject: [PATCH] Fix #5856: Wrong order of switching images in maximize mode (#6068) * Fix #5856: Wrong order of switching images in maximize mode Co-authored-by: llcc --- src/main/frontend/components/block.cljs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/frontend/components/block.cljs b/src/main/frontend/components/block.cljs index f28ea1685a..32407227d5 100644 --- a/src/main/frontend/components/block.cljs +++ b/src/main/frontend/components/block.cljs @@ -245,7 +245,11 @@ images (if-not (= (count images) 1) (let [^js _image (.closest (.-target e) ".asset-container") image (. _image querySelector "img")] - (cons image (remove #(= image %) images))) + (->> images + (sort-by (juxt #(.-y %) #(.-x %))) + (split-with (complement #{image})) + reverse + (apply concat))) images) images (for [^js it images] {:src (.-src it) :w (.-naturalWidth it)