- var dispWidth = getObjectWidth(this.stretchable);
- var imgWidth = this.pendingImage.width;
- var dispHeight = getObjectHeight(this.stretchable);
- var imgHeight = this.pendingImage.height;
- var ratio;
-
- if (imgHeight > dispHeight) {
- ratio = dispHeight / imgHeight;
- imgWidth = imgWidth * ratio;
- imgHeight = dispHeight;
- }
- if (imgWidth > dispWidth) {
- ratio = dispWidth / imgWidth;
- imgHeight = imgHeight * ratio;
- imgWidth = dispWidth;
- }
-