show or hide the widget. popcorn-port
authorhamidouk
Thu, 12 Jan 2012 15:33:50 +0100
branchpopcorn-port
changeset 619 2abc7d900f5e
parent 618 79c9a05ddaed
child 620 fe981f0aab71
show or hide the widget.
src/js/widgets/sliceWidget.js
--- a/src/js/widgets/sliceWidget.js	Thu Jan 12 15:33:34 2012 +0100
+++ b/src/js/widgets/sliceWidget.js	Thu Jan 12 15:33:50 2012 +0100
@@ -36,9 +36,16 @@
   
   this._Popcorn.listen("IriSP.SliceWidget.position", 
                         IriSP.wrap(this, this.positionSliceHandler));
-  this._Popcorn.trigger("IriSP.SliceWidget.position", [57, 24]);
+  
+  this._Popcorn.listen("IriSP.SliceWidget.show", IriSP.wrap(this, this.show));
+  this._Popcorn.listen("IriSP.SliceWidget.hide", IriSP.wrap(this, this.hide));
+  this.selector.hide();
 };
 
+/** responds to an "IriSP.SliceWidget.position" message
+    @param params an array with the first element being the left distance in
+           percents and the second element the width of the slice in pixels
+*/        
 IriSP.SliceWidget.prototype.positionSliceHandler = function(params) {
   left = params[0];
   width = params[1];
@@ -107,4 +114,12 @@
   var zonePercent = (this.zoneWidth / this.selector.width()) * 100;
   
   this._Popcorn.trigger("IriSP.SliceWidget.zoneChange", [leftPercent, zonePercent]);  
+};
+
+IriSP.SliceWidget.prototype.show = function() {
+  this.selector.show();
+};
+
+IriSP.SliceWidget.prototype.hide = function() {
+  this.selector.hide();
 };
\ No newline at end of file