| author | hamidouk |
| Wed, 23 Nov 2011 15:45:41 +0100 | |
| branch | popcorn-port |
| changeset 313 | 7df805ebb75e |
| parent 305 | e8d05c3f77ed |
| child 321 | 21d840371c6b |
| permissions | -rw-r--r-- |
| 299 | 1 |
IriSP.ArrowWidget = function(Popcorn, config, Serializer) { |
2 |
IriSP.Widget.call(this, Popcorn, config, Serializer); |
|
3 |
|
|
4 |
}; |
|
5 |
||
6 |
||
7 |
IriSP.ArrowWidget.prototype = new IriSP.Widget(); |
|
8 |
||
9 |
IriSP.ArrowWidget.prototype.clear = function() { |
|
10 |
||
11 |
}; |
|
12 |
||
13 |
IriSP.ArrowWidget.prototype.clearWidget = function() { |
|
14 |
}; |
|
15 |
||
16 |
IriSP.ArrowWidget.prototype.draw = function() { |
|
17 |
var templ = Mustache.to_html(IriSP.arrowWidget_template, {}); |
|
18 |
this.selector.append(templ); |
|
| 305 | 19 |
this._Popcorn.listen("IriSP.SegmentsWidget.segmentClick", IriSP.wrap(this, this.segmentClickHandler)); |
| 299 | 20 |
}; |
| 305 | 21 |
|
22 |
IriSP.ArrowWidget.prototype.segmentClickHandler = function(percents) { |
|
|
313
7df805ebb75e
fixed some rounding errrors in segmentsWidget.js and animated the arrow and added
hamidouk
parents:
305
diff
changeset
|
23 |
// we need to apply a fix because the arrow has a certain length |
|
7df805ebb75e
fixed some rounding errrors in segmentsWidget.js and animated the arrow and added
hamidouk
parents:
305
diff
changeset
|
24 |
// it's half the length of the arrow (27 / 2). We need to convert |
|
7df805ebb75e
fixed some rounding errrors in segmentsWidget.js and animated the arrow and added
hamidouk
parents:
305
diff
changeset
|
25 |
// it in percents though. |
|
7df805ebb75e
fixed some rounding errrors in segmentsWidget.js and animated the arrow and added
hamidouk
parents:
305
diff
changeset
|
26 |
var totalWidth = this.selector.width(); |
|
7df805ebb75e
fixed some rounding errrors in segmentsWidget.js and animated the arrow and added
hamidouk
parents:
305
diff
changeset
|
27 |
var correction = ((27 / 2) / totalWidth) * 100; |
|
7df805ebb75e
fixed some rounding errrors in segmentsWidget.js and animated the arrow and added
hamidouk
parents:
305
diff
changeset
|
28 |
var corrected_percents = percents - correction; |
|
7df805ebb75e
fixed some rounding errrors in segmentsWidget.js and animated the arrow and added
hamidouk
parents:
305
diff
changeset
|
29 |
this.selector.children(".Ldt-arrowWidget").animate({"left" : corrected_percents + "%"}); |
| 305 | 30 |
} |