ref: 84e02b8c87fcbf93e0404a691365d567c1e7808c
parent: e021404c8ff51fc3d2b455b1983f2a06d0214bf1
author: Olav Sørensen <olav.sorensen@live.no>
date: Mon Dec 13 10:07:22 EST 2021
Kludge for marking last sample point in fullscreen mode
--- a/src/ft2_sample_ed.c
+++ b/src/ft2_sample_ed.c
@@ -3321,8 +3321,8 @@
if (editor.curInstr == 0)
return;
- const int32_t mx = CLAMP(mouse.x, 0, SCREEN_W+8); // allow some pixels outside of the screen
- const int32_t my = CLAMP(mouse.y, 0, SCREEN_H-1);
+ int32_t mx = CLAMP(mouse.x, 0, SCREEN_W+8); // allow some pixels outside of the screen
+ int32_t my = CLAMP(mouse.y, 0, SCREEN_H-1);
if (!mouseButtonHeld)
{
@@ -3411,13 +3411,20 @@
else if (ui.sampleDataOrLoopDrag >= 0)
{
// mark data
+
lastMouseX = mx;
- if (lastMouseX > ui.sampleDataOrLoopDrag)
+ /* Edge-case hack for fullscreen sample marking where the width
+ ** of the image fills the whole screen (or close).
+ */
+ if (video.fullscreen && video.renderW >= video.displayW-5 && mx == SCREEN_W-1)
+ mx = SCREEN_W;
+
+ if (mx > ui.sampleDataOrLoopDrag)
setSampleRange(ui.sampleDataOrLoopDrag, mx);
- else if (lastMouseX == ui.sampleDataOrLoopDrag)
+ else if (mx == ui.sampleDataOrLoopDrag)
setSampleRange(ui.sampleDataOrLoopDrag, ui.sampleDataOrLoopDrag);
- else if (lastMouseX < ui.sampleDataOrLoopDrag)
+ else if (mx < ui.sampleDataOrLoopDrag)
setSampleRange(mx, ui.sampleDataOrLoopDrag);
}
}