From dcb6657e06a8316e51db874467940d5dafb95f97 Mon Sep 17 00:00:00 2001
From: ale rimoldi <ale@graphicslab.org>
Date: Thu, 11 Sep 2025 14:02:24 +0200
Subject: shift-click outside of the margins fills the bleeds


diff --git a/scribus/scribusdoc.cpp b/scribus/scribusdoc.cpp
index 682df23d4..88c91c5d0 100644
--- a/scribus/scribusdoc.cpp
+++ b/scribus/scribusdoc.cpp
@@ -5345,6 +5345,16 @@ int ScribusDoc::itemAddArea(const PageItem::ItemType itemType, const PageItem::I
 {
 	double xo = m_currentPage->xOffset();
 	double yo = m_currentPage->yOffset();
+	// if the click is outside of the margins, fill the bleeds
+	if (x < xo + m_currentPage->margins().left() ||
+	    x > xo + m_currentPage->width() - m_currentPage->margins().right() ||
+	    y < yo + m_currentPage->margins().top() ||
+	    y > yo + m_currentPage->height() - m_currentPage->margins().bottom())
+	{
+		QRectF bleeds = m_currentPage->bleedRect();
+		return itemAdd(itemType, frameType, bleeds.x(), bleeds.y(),  bleeds.width(),  bleeds.height(), w, fill, outline, itemKind);
+	}
+	// fill to the closest guide or margin
 	QPair<double, double> tl = m_currentPage->guides.topLeft(x - xo, y - yo);
 	QPair<double, double> tr = m_currentPage->guides.topRight(x - xo, y - yo);
 	QPair<double, double> bl = m_currentPage->guides.bottomLeft(x - xo, y - yo);
diff --git a/scribus/scribusdoc.h b/scribus/scribusdoc.h
index 2c0f8e5d1..3510c9436 100644
--- a/scribus/scribusdoc.h
+++ b/scribus/scribusdoc.h
@@ -858,7 +858,7 @@ public:
 	*/
 	int itemAdd(const PageItem::ItemType itemType, const PageItem::ItemFrameType frameType, double x, double y, double b, double h, double w, const QString& fill, const QString& outline, PageItem::ItemKind itemKind = PageItem::StandardItem);
 
-	/** Add an item to the page based on the x/y position. Item will be fitted to the closest guides/margins */
+	/** Add an item to the page based on the x/y position. Item will be fitted the closest guides/margins or the bleeds */
 	int itemAddArea(const PageItem::ItemType itemType, const PageItem::ItemFrameType frameType, double x, double y, double w, const QString& fill, const QString& outline, PageItem::ItemKind itemKind = PageItem::StandardItem);
 	
 	/**
