@@ -767,11 +767,11 @@ regionview_resize(Regionview *regionview, guint modifiers,
767767 VipsRect * our_area = & regionview -> our_area ;
768768 VipsRect * start_area = & regionview -> start_area ;
769769
770+ // move dependent edges
770771 switch (regionview -> resize ) {
771772 case REGIONVIEW_RESIZE_MOVE :
772773 our_area -> left = x + start_area -> left ;
773774 our_area -> top = y + start_area -> top ;
774- imageui_snap_rect (imageui , our_area , our_area );
775775 break ;
776776
777777 case REGIONVIEW_RESIZE_TOPLEFT :
@@ -814,9 +814,56 @@ regionview_resize(Regionview *regionview, guint modifiers,
814814 break ;
815815 }
816816
817+ // apply any snapping
818+ int right ;
819+ int bottom ;
820+ switch (regionview -> resize ) {
821+ case REGIONVIEW_RESIZE_MOVE :
822+ imageui_snap_rect (imageui , our_area , our_area );
823+ break ;
824+
825+ case REGIONVIEW_RESIZE_LEFT :
826+ case REGIONVIEW_RESIZE_TOPLEFT :
827+ case REGIONVIEW_RESIZE_TOP :
828+ imageui_snap_point (imageui ,
829+ our_area -> left , our_area -> top , & our_area -> left , & our_area -> top );
830+ break ;
831+
832+ case REGIONVIEW_RESIZE_RIGHT :
833+ case REGIONVIEW_RESIZE_BOTTOMRIGHT :
834+ case REGIONVIEW_RESIZE_BOTTOM :
835+ right = VIPS_RECT_RIGHT (our_area );
836+ bottom = VIPS_RECT_BOTTOM (our_area );
837+ imageui_snap_point (imageui ,
838+ right , bottom , & right , & bottom );
839+ our_area -> width = right - our_area -> left ;
840+ our_area -> height = bottom - our_area -> top ;
841+ break ;
842+
843+ case REGIONVIEW_RESIZE_TOPRIGHT :
844+ right = VIPS_RECT_RIGHT (our_area );
845+ imageui_snap_point (imageui ,
846+ right , our_area -> top , & right , & our_area -> top );
847+ our_area -> width = right - our_area -> left ;
848+ break ;
849+
850+ case REGIONVIEW_RESIZE_BOTTOMLEFT :
851+ bottom = VIPS_RECT_BOTTOM (our_area );
852+ imageui_snap_point (imageui ,
853+ our_area -> left , bottom , & our_area -> left , & bottom );
854+ our_area -> height = bottom - our_area -> top ;
855+
856+ break ;
857+
858+ default :
859+ break ;
860+ }
861+
862+
817863 if (!regionview -> frozen )
818864 regionview_pick_type (regionview );
819865
866+ // constrain
820867 switch (regionview -> type ) {
821868 case REGIONVIEW_REGION :
822869 case REGIONVIEW_MARK :
@@ -897,7 +944,6 @@ regionview_resize(Regionview *regionview, guint modifiers,
897944 default :
898945 break ;
899946 }
900-
901947}
902948
903949static void
0 commit comments