Skip to content

Instantly share code, notes, and snippets.

@hilukasz
Created May 30, 2012 03:58
Show Gist options
  • Save hilukasz/2833659 to your computer and use it in GitHub Desktop.
Save hilukasz/2833659 to your computer and use it in GitHub Desktop.
function MySymbol(input){
this.doc = app.activeDocument;
this.mySymbolIndex = input || 0;
this.mySymbolItem = this.hasSymbolIndex() ? this.doc.symbolItems[this.mySymbolIndex] : false;
}
MySymbol.prototype.hasSymbolIndex = function() {
return this.mySymbolIndex <= this.doc.symbolItems.length - 1;
};
MySymbol.prototype.getWidth = function() {
return this.mySymbolItem ? Math.round(this.mySymbolItem.width) : 0;
};
MySymbol.prototype.getHeight = function() {
return this.mySymbolItem ? Math.round(this.mySymbolItem.height) : 0;
};
// returns width and height as an array
MySymbol.prototype.getWidthHeight = function() {
var widthAndHeight = [];
widthAndHeight.push(this.getWidth());
widthAndHeight.push(this.getHeight());
return widthAndHeight;
}
var firstSymbol = new MySymbol(0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment