Commit 4d5f5a75 authored by Robert Sprowson's avatar Robert Sprowson Committed by ROOL
Browse files

[445] Fix for failing to transform text areas properly

The calculation in scale_textC() was using the origin of the group rather than the origin of the text column, and hence when a group of text areas was transformed (xscale/yscale/magnify) all the text got clumped up in the top left corner.
Delete scale_textcolumn() since Draw object 10 can only occur nested inside a text area, there's no need to have a handler for it.

Version 1.39. Tagged as 'Draw-1_39'
parent 430dd220
......@@ -9,12 +9,12 @@
GBLS Module_ApplicationDate
GBLS Module_HelpVersion
GBLS Module_ComponentName
Module_MajorVersion SETS "1.38"
Module_Version SETA 138
Module_MajorVersion SETS "1.39"
Module_Version SETA 139
Module_MinorVersion SETS ""
Module_Date SETS "04 Mar 2020"
Module_ApplicationDate SETS "04-Mar-20"
Module_ComponentName SETS "Draw"
Module_FullVersion SETS "1.38"
Module_HelpVersion SETS "1.38 (04 Mar 2020)"
Module_FullVersion SETS "1.39"
Module_HelpVersion SETS "1.39 (04 Mar 2020)"
END
/* (1.38)
/* (1.39)
*
* This file is automatically maintained by srccommit, do not edit manually.
*
*/
#define Module_MajorVersion_CMHG 1.38
#define Module_MajorVersion_CMHG 1.39
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 04 Mar 2020
#define Module_MajorVersion "1.38"
#define Module_Version 138
#define Module_MajorVersion "1.39"
#define Module_Version 139
#define Module_MinorVersion ""
#define Module_Date "04 Mar 2020"
......@@ -16,6 +16,6 @@
#define Module_ComponentName "Draw"
#define Module_FullVersion "1.38"
#define Module_HelpVersion "1.38 (04 Mar 2020)"
#define Module_LibraryVersionInfo "1:38"
#define Module_FullVersion "1.39"
#define Module_HelpVersion "1.39 (04 Mar 2020)"
#define Module_LibraryVersionInfo "1:39"
......@@ -754,16 +754,11 @@ static void fscale_coord (scale_typ *scale, double *point)
point [1] = fpoint_scale (point [1], scale->yscale, scale->org.y);
}
/*Same, but absolute*/
static void scale_coord_abs (scale_typ *scale, int *point)
{ point[0] = point_scale (point[0], fabs (scale->xscale), scale->org.x);
point[1] = point_scale (point[1], fabs (scale->yscale), scale->org.y);
/*>>> point[0] = (int) ((point[0] - scale->org.x) * fabs (scale->xscale)
+ scale->org.x);
point[1] = (int) ((point[1] - scale->org.y) * fabs (scale->yscale)
+ scale->org.y);
*/
}
/*Scale text: the font manager cannot accept -ve point sizes, so we cannot*/
......@@ -895,7 +890,7 @@ static void scale_textC (draw_objptr hdrptr, scale_typ *scale)
{ draw_bboxtyp box;
int width, height;
int topx, basey;
int coord;
draw_textcolhdr *column = hdrptr.textcolp;
/*Calculate new width and height*/
......@@ -904,27 +899,25 @@ static void scale_textC (draw_objptr hdrptr, scale_typ *scale)
height= (int) (scale->yscale* ((double) box.y1 - (double) box.y0));
/*Find new corner*/
topx = scale->org.x + width;
basey = scale->org.y - height;
/*Swap corners if wrong way round; else log new bbox*/
if (topx > scale->org.x)
{ column->bbox.x0 = scale->org.x;
column->bbox.x1 = topx;
scale_coord (scale, &box.x0);
box.x1 = box.x0 + width;
box.y1 = box.y0 + height;
/*Swap corners if wrong way round, for example if the scale
is -ve (a reflection in the x or y axis)*/
if (box.x0 > box.x1)
{ coord = box.x1;
box.x1 = box.x0;
box.x0 = coord;
}
else
{ column->bbox.x0 = topx;
column->bbox.x1 = scale->org.x;
if (box.y0 > box.y1)
{ coord = box.y1;
box.y1 = box.y0;
box.y0 = coord;
}
if (basey < scale->org.y)
{ column->bbox.y0 = basey;
column->bbox.y1 = scale->org.y;
}
else
{ column->bbox.y0 = scale->org.y;
column->bbox.y1 = basey;
}
/*Assign*/
column->bbox = box;
}
static void scale_textarea (draw_objptr hdrptr, scale_typ *scale)
......@@ -947,22 +940,6 @@ static void scale_textarea (draw_objptr hdrptr, scale_typ *scale)
}
}
static void scale_textcolumn (draw_objptr hdrptr, scale_typ *scale)
{ draw_objptr parent = draw_text_findParent (hdrptr.textcolp);
/*Save undo on the parent*/
full_set_undo (scale->diag, parent);
scale_check (hdrptr, scale, NULL);
/*Do the scaling*/
scale_textC (hdrptr, scale);
/*Recalculate parent bbox*/
draw_text_rebound (parent);
}
static void scale_trfmtext (draw_objptr hdrptr, scale_typ *scale)
{ double
......@@ -1120,7 +1097,7 @@ static despatch_tab scaletab[3] =
{ 0 /*fontlist*/, scale_text, scale_pathB,
0 /*rect*/, 0 /*elli*/, scale_sprite,
scale_group, 0 /*tagged*/, 0 /*'8'*/,
scale_textarea, scale_textcolumn, 0 /*option*/,
scale_textarea, 0 /*textcolumn*/, 0 /*option*/,
scale_trfmtext, scale_trfmsprite, 0,
0, scale_jpeg
},
......@@ -1129,7 +1106,7 @@ static despatch_tab scaletab[3] =
{ 0 /*fontlist*/, scale_text, scale_pathBL,
0 /*rect*/, 0 /*elli*/, scale_sprite,
scale_group, 0 /*tagged*/, 0 /*'8'*/,
scale_textarea, scale_textcolumn, 0 /*option*/,
scale_textarea, 0 /*textcolumn*/, 0 /*option*/,
scale_trfmtext, scale_trfmsprite, 0,
0, scale_jpeg
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment