forked from johnwun/js4ai
-
Notifications
You must be signed in to change notification settings - Fork 0
/
to100Pct.jsx
33 lines (32 loc) · 1.14 KB
/
to100Pct.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/////////////////////////////////////////////////////////////////
// to100pct v.1.0 -- CS,CS2,CS3,CS4,CS5
//>=--------------------------------------
// Addresses an issue when images are pasted from the clipboard at 70%
// This script resets the matrix values for pasted RasterItems so they display at 100%.
// Multiple raster items can be transformed at the same time, group items will be introspected, only raster items are affected.
//>=--------------------------------------
// JS code (c) copyright: John Wundes ( [email protected] ) www.wundes.com
//copyright full text here: http://www.wundes.com/js4ai/copyright.txt
//////////////////////////////////////////////////////////////////
if(activeDocument && activeDocument.selection.length>0){
testObjects(activeDocument.selection);
}
function testObjects(a)
{
var selLen = a.length;
for (var c=0;c<selLen;c++)
{
if(a[c].typename == 'GroupItem'){
testObjects(a[c].pageItems);
} else if(a[c].typename=='RasterItem')
{
fullsize(a[c]);
}
}
}
function fullsize(i)
{
// maintain sign
i.matrix.mValueA = i.matrix.mValueA >0 ? 1 : -1;
i.matrix.mValueD = i.matrix.mValueD>0 ? 1 : -1;
}