ref: 40583e8b975a1d6170f8259e03bb7f5166d7de3e
parent: f4c7ec8b99c5cf5ec1a308614b16e09248647f1f
author: phil9 <[email protected]>
date: Mon Jan 18 15:52:12 EST 2021
do not crop when selected area is below 5px wide
--- a/vcrop.c
+++ b/vcrop.c
@@ -4,6 +4,11 @@
#include <event.h>
#include <keyboard.h>
+enum
+{
+ Threshold = 5,
+};
+
Image *bg;
Image *p;
Image *n;
@@ -27,7 +32,7 @@
Image *i;
r = egetrect(1, m);
- if(eqrect(r, ZR) || badrect(r))
+ if(eqrect(r, ZR) || badrect(r) || (Dx(r)<Threshold && Dy(r)<Threshold))
return;
i = allocimage(display, Rect(0,0,Dx(r),Dy(r)), screen->chan, 0, DNofill);
if(i==nil)