2007-09-15 03:08:25 +02:00
|
|
|
/**
|
|
|
|
* @author Mateusz
|
2009-06-18 01:14:01 +02:00
|
|
|
*/
|
2007-10-03 01:26:35 +02:00
|
|
|
ImageEditor.ImageBox = {
|
2007-09-15 03:08:25 +02:00
|
|
|
|
|
|
|
initialize: function() {
|
2007-09-16 02:49:34 +02:00
|
|
|
this.indicatorWidth = 32;
|
|
|
|
this.indicatorHeight = 32;
|
2007-10-03 01:26:35 +02:00
|
|
|
this.showIndicator = ImageEditor.ImageBox.showIndicator.bind(this);
|
|
|
|
this.hideIndicator = ImageEditor.ImageBox.hideIndicator.bind(this);
|
|
|
|
this.reCenterIndicator = ImageEditor.ImageBox.reCenterIndicator.bind(this);
|
|
|
|
this.centerIndicator = ImageEditor.ImageBox.centerIndicator.bind(this);
|
|
|
|
this.center = ImageEditor.ImageBox.center.bind(this);
|
|
|
|
this.imageContainer = ImageEditor.Positioning.addBehaviour($('imageContainer'));
|
2007-09-15 22:53:26 +02:00
|
|
|
Element.hide(this.imageContainer);
|
2007-10-03 01:26:35 +02:00
|
|
|
this.indicator = ImageEditor.Positioning.addBehaviour($('loadingIndicatorContainer'));
|
|
|
|
this.indicatorImage = ImageEditor.Positioning.addBehaviour($('loadingIndicator'));
|
|
|
|
ImageEditor.Positioning.addBehaviour($('Main'));
|
2007-09-15 03:08:25 +02:00
|
|
|
},
|
|
|
|
|
2007-09-15 22:53:26 +02:00
|
|
|
showIndicator: function(container) {
|
2007-09-16 02:49:34 +02:00
|
|
|
Element.show(this.indicator,this.indicatorImage);
|
2007-09-15 22:53:26 +02:00
|
|
|
if(container == null) container = this.imageContainer;
|
|
|
|
this.centerIndicator(container);
|
2007-09-15 03:08:25 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
hideIndicator: function() {
|
2007-09-16 02:49:34 +02:00
|
|
|
Element.hide(this.indicator,this.indicatorImage);
|
2007-09-15 03:08:25 +02:00
|
|
|
},
|
|
|
|
|
2007-09-15 22:53:26 +02:00
|
|
|
centerIndicator: function(container) {
|
|
|
|
var top = container.getTop();
|
|
|
|
var left = container.getLeft();
|
|
|
|
var width = container.getWidth();
|
|
|
|
var height = container.getHeight();
|
|
|
|
var parentTop = container.getParentTop();
|
|
|
|
var parentLeft = container.getParentLeft();
|
2007-09-16 03:30:43 +02:00
|
|
|
this.indicator.style.left = width/2 - this.indicatorWidth/2 + "px";
|
|
|
|
this.indicator.style.top = height/2 - this.indicatorHeight/2 + "px";
|
2007-09-15 03:08:25 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
reCenterIndicator: function() {
|
2007-09-16 03:30:43 +02:00
|
|
|
if(Element.visible(this.indicator)) {
|
2007-09-15 22:53:26 +02:00
|
|
|
this.centerIndicator(this.imageContainer);
|
2007-09-15 03:08:25 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
center: function() {
|
2007-09-15 22:53:26 +02:00
|
|
|
this.imageContainer.style.left = this.imageContainer.getParentWidth()/2 - this.imageContainer.getWidth()/2 + 'px';
|
|
|
|
this.imageContainer.style.top = this.imageContainer.getParentHeight()/2 - this.imageContainer.getHeight()/2 + 'px';
|
2007-09-15 03:08:25 +02:00
|
|
|
}
|
|
|
|
};
|