Call Image.prototype.onDraw() only once?
I have created a ScriptUI dialog that displays an image who's size can be manipulated by changing some settings of the native Image class like so just before the image is rendered:
Image.prototype.onDraw() = function() {
...
this.graphics.drawImage(this.image, xy[0], xy[1], imageSize[0], imageSize[1])
}This works perfectly, my image looks great and fits exactly how I want it to inside the dialog box. But for some reason the onDraw() method keeps getting called repeatedly and I don't know how to stop it. Whenever an image is about to be rendered I expect this method to only be called once. I can't understand why this method would keep getting executed if I have only tried to display a single image once. This infinite loop of method calling causes the performance of the dialog box to be reduced/becomes laggy as the image keeps getting redrawn 50 or so times every second. The lag isn't terrible though as the dialog window is still usable and can serve it's purpose. I just want to get rid of this infinite loop since it's causing the lag and making adding other features difficult.
Any ideas how to make it so that onDraw() only happends once? Or is there another solution?
Thanks!
