The initial value of mValueTX and mValueTY
Hello.
Does the initial values of mValueTX and mValueTY of the object just generated refer the upper left coordinates of the document's largest area? For example, TextFrameItem and PlacedItem.
I want to get the coordinates of the document's largest area easily. Do you have any sugesstions?
I referred to here.
How to get bounds of largest possible document area?
This script worked fine on Illustrator CS6, CC2015, CC2017, CC2018 (for mac).
Is this correct?
function getLargestBounds() {
var tempLayer,
tempText,
left,
top,
LARGEST_SIZE = 16383;
if (!app.documents.length) {
return;
}
tempLayer = app.activeDocument.layers.add();
tempText = tempLayer.textFrames.add();
left = tempText.matrix.mValueTX;
top = tempText.matrix.mValueTY;
tempLayer.remove();
return new Rect(
left,
top,
left + LARGEST_SIZE,
top + LARGEST_SIZE
);
}
var rect = getLargestBounds();
// cover the whole area.
app.activeDocument.pathItems.rectangle(rect[1], rect[0], 16383, 16383);
