weekend codewarrior.
¶ by Rob Frieselso i got past the first phase, ascertaining that although it should work, it does not:
...
mouseOut.pageItems[i].pathPoints[j].anchor[0] -= 180;
...
Consequently, my elegant solution was axed in favor of a much clunkier (though functional) one … but before I could even get that far … it also became necessary to realize that the object in question had not 1 property to manipulate (a la, 2 dimensions) but 3…
for (i=0; i<mouseOut.pageItems.length; i++) {
if (mouseOut.pageItems[i].typename == "PathItem") {
for (j=0; j<mouseOut.pageItems[i].pathPoints.length; j++) {
if (mouseOut.pageItems[i].pathPoints[j].anchor[0] > 180) {
var ax = (mouseOut.pageItems[i].pathPoints[j].anchor[0] - 180);
var ay = mouseOut.pageItems[i].pathPoints[j].anchor[1];
var lx = (mouseOut.pageItems[i].pathPoints[j].leftDirection[0] - 180);
var ly = mouseOut.pageItems[i].pathPoints[j].leftDirection[1];
var rx = (mouseOut.pageItems[i].pathPoints[j].rightDirection[0] - 180);
var ry = mouseOut.pageItems[i].pathPoints[j].rightDirection[1];
mouseOut.pageItems[i].pathPoints[j].anchor = new Array(ax, ay);
mouseOut.pageItems[i].pathPoints[j].leftDirection = new Array(lx, ly);
mouseOut.pageItems[i].pathPoints[j].rightDirection = new Array(rx, ry);
}}}}
Where 180 is just an arbitrary integer value to test certain conditions.
And so… We establish the methodology for use against the problem w/r/t/ adjusting a given shape’s “dangling” side when rubbing up against activeDocument.layer["text"].textArtItems[x].width. Success!?
not so fast, tough guy
We need to remember that we’re working w/ a dataset… Hence that whole for (i=0; i<activeDocument.dataSets.length; i++) { activeDocument.dataSets[i].display(); /* ... assorted functions ... */ } nonesense. right But remember that said given shape’s dimensions are going to be manipulated as we cycle through each element of the dataset. So the new problem is now to accommodate those shifts (since the position change of each given “dangling point” is determined as delta relative to the width of the text object AND relative to its previous/original position [i.e., multiple points shifting leftward … each point moving a fixed distance {to maintain their positions relative to each other, hence an absolute delta value} though that shift is NOT absolute w/r/t/ what determines it] and cannot [as I see it so far] be determined as being an absolute position change [i.e., x = w-(t+p), NOT x = t+p])… where was I? Right! So, we need to generate an array that represents the matrix of original values for all points {x(n)} on a given shape {y} SO THAT AFTER adjusting approx. half of those points {a subset of x(n) where x(n)’s x-axis value is greater than the width of a text object} they can be returned to their original values for the next batch of adjustments. Hence:
var moap = new Array();
function getMoap () {
for (j=0; j<layer.pageItem.pathPoints.length; j++) {
moap.push( new Array( layer.pageItem.pathPoints[j].anchor[0], layer.pageItem.pathPoints[j].anchor[1] ) );
}
return moap;
}
….which still doesn’t address the whole problem (re: 6 dimensions) but chokes just the same and for no reason that has presented itself as obvious so far.
So why is it 4pm on a Sunday before I say something like: “Time to take the rest of the weekend off…” ??
Leave a Reply