src/js/widgets/sliderWidget.js
author veltr
Wed, 29 Feb 2012 18:13:14 +0100
branchpopcorn-port
changeset 820 7968346b9689
parent 740 3b60f3beb521
child 838 03b03865eb9b
permissions -rw-r--r--
Added compatibility with cinecast format (with get_aliased)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
289
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
     1
IriSP.SliderWidget = function(Popcorn, config, Serializer) {
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
     2
  IriSP.Widget.call(this, Popcorn, config, Serializer);
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
     3
};
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
     4
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
     5
IriSP.SliderWidget.prototype = new IriSP.Widget();
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
     6
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
     7
IriSP.SliderWidget.prototype.draw = function() {
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
     8
  var self = this;
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
     9
316
3b11a798f5e4 WIP - reorganizing the sliderWidget.
hamidouk
parents: 289
diff changeset
    10
  this.selector.append(Mustache.to_html(IriSP.sliderWidget_template, {}));
324
abe961b7f295 a slider that more or less works.
hamidouk
parents: 322
diff changeset
    11
  this.selector.addClass("Ldt-SliderMinimized");
289
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
    12
316
3b11a798f5e4 WIP - reorganizing the sliderWidget.
hamidouk
parents: 289
diff changeset
    13
  this.sliderBackground = this.selector.find(".Ldt-sliderBackground");
3b11a798f5e4 WIP - reorganizing the sliderWidget.
hamidouk
parents: 289
diff changeset
    14
  this.sliderForeground = this.selector.find(".Ldt-sliderForeground");
3b11a798f5e4 WIP - reorganizing the sliderWidget.
hamidouk
parents: 289
diff changeset
    15
  this.positionMarker = this.selector.find(".Ldt-sliderPositionMarker");
289
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
    16
324
abe961b7f295 a slider that more or less works.
hamidouk
parents: 322
diff changeset
    17
289
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
    18
  // a special variable to stop methods from tinkering
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
    19
  // with the positionMarker when the user is dragging it
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
    20
  this.draggingOngoing = false;
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
    21
347
9c55d584d3a9 slider maximization when rolled over now works.
hamidouk
parents: 332
diff changeset
    22
  // another special variable used by the timeout handler to
9c55d584d3a9 slider maximization when rolled over now works.
hamidouk
parents: 332
diff changeset
    23
  // open or close the slider.
9c55d584d3a9 slider maximization when rolled over now works.
hamidouk
parents: 332
diff changeset
    24
  this.sliderMaximized = false;
9c55d584d3a9 slider maximization when rolled over now works.
hamidouk
parents: 332
diff changeset
    25
  this.timeOutId = null;
9c55d584d3a9 slider maximization when rolled over now works.
hamidouk
parents: 332
diff changeset
    26
481
a46cfeee6d77 using jquery ui draggable changes the state of an element from absolute to relative
hamidouk
parents: 476
diff changeset
    27
  
289
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
    28
  this.positionMarker.draggable({axis: "x",
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
    29
  start: IriSP.wrap(this, this.positionMarkerDraggingStartedHandler),
322
6fc87426ecd4 fixed slider bug where the slider could be dragged out of his parent div.
hamidouk
parents: 316
diff changeset
    30
  stop: IriSP.wrap(this, this.positionMarkerDraggedHandler),
6fc87426ecd4 fixed slider bug where the slider could be dragged out of his parent div.
hamidouk
parents: 316
diff changeset
    31
  containment: "parent"
6fc87426ecd4 fixed slider bug where the slider could be dragged out of his parent div.
hamidouk
parents: 316
diff changeset
    32
  });
481
a46cfeee6d77 using jquery ui draggable changes the state of an element from absolute to relative
hamidouk
parents: 476
diff changeset
    33
  this.positionMarker.css("position", "absolute");
a46cfeee6d77 using jquery ui draggable changes the state of an element from absolute to relative
hamidouk
parents: 476
diff changeset
    34
  
330
156ea1d74223 fixed a bug where clicks on the slider foreground would not be taken into account.
hamidouk
parents: 329
diff changeset
    35
  this.sliderBackground.click(function(event) { self.backgroundClickHandler.call(self, event); });
156ea1d74223 fixed a bug where clicks on the slider foreground would not be taken into account.
hamidouk
parents: 329
diff changeset
    36
  this.sliderForeground.click(function(event) { self.foregroundClickHandler.call(self, event); });
289
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
    37
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
    38
  this.selector.hover(IriSP.wrap(this, this.mouseOverHandler), IriSP.wrap(this, this.mouseOutHandler));
332
3c40f2e862d2 sliderWidget catches the message sent by the player widget and expands itself accordingly.
hamidouk
parents: 330
diff changeset
    39
3c40f2e862d2 sliderWidget catches the message sent by the player widget and expands itself accordingly.
hamidouk
parents: 330
diff changeset
    40
  // update the positions
289
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
    41
  this._Popcorn.listen("timeupdate", IriSP.wrap(this, this.sliderUpdater));
332
3c40f2e862d2 sliderWidget catches the message sent by the player widget and expands itself accordingly.
hamidouk
parents: 330
diff changeset
    42
3c40f2e862d2 sliderWidget catches the message sent by the player widget and expands itself accordingly.
hamidouk
parents: 330
diff changeset
    43
  // special messages :
3c40f2e862d2 sliderWidget catches the message sent by the player widget and expands itself accordingly.
hamidouk
parents: 330
diff changeset
    44
  this._Popcorn.listen("IriSP.PlayerWidget.MouseOver", IriSP.wrap(this, this.mouseOverHandler));
3c40f2e862d2 sliderWidget catches the message sent by the player widget and expands itself accordingly.
hamidouk
parents: 330
diff changeset
    45
  this._Popcorn.listen("IriSP.PlayerWidget.MouseOut", IriSP.wrap(this, this.mouseOutHandler));
289
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
    46
};
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
    47
322
6fc87426ecd4 fixed slider bug where the slider could be dragged out of his parent div.
hamidouk
parents: 316
diff changeset
    48
/* update the slider and the position marker as time passes */
289
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
    49
IriSP.SliderWidget.prototype.sliderUpdater = function() {
488
ab73470647cb fixed seeking bug and jerky scrolling.
hamidouk
parents: 481
diff changeset
    50
  if(this.draggingOngoing || this._disableUpdate)
289
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
    51
    return;
472
1da76db24aa8 fixed stupid && bug.
hamidouk
parents: 471
diff changeset
    52
  
289
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
    53
  var time = this._Popcorn.currentTime();
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
    54
820
7968346b9689 Added compatibility with cinecast format (with get_aliased)
veltr
parents: 740
diff changeset
    55
  var duration = this._serializer.getDuration() / 1000;
739
d28b9acfc445 moved the sliderWidget from percents to pixels. It now has a satisfying display.
hamidouk
parents: 731
diff changeset
    56
  var percents = time / duration;
471
af5b1db6fd0b center the slider exactly under the other position markers.
hamidouk
parents: 469
diff changeset
    57
  
af5b1db6fd0b center the slider exactly under the other position markers.
hamidouk
parents: 469
diff changeset
    58
  /* we do these complicated calculations to center exactly
af5b1db6fd0b center the slider exactly under the other position markers.
hamidouk
parents: 469
diff changeset
    59
     the position Marker */
739
d28b9acfc445 moved the sliderWidget from percents to pixels. It now has a satisfying display.
hamidouk
parents: 731
diff changeset
    60
d28b9acfc445 moved the sliderWidget from percents to pixels. It now has a satisfying display.
hamidouk
parents: 731
diff changeset
    61
  var divWidth = this.selector.width();
d28b9acfc445 moved the sliderWidget from percents to pixels. It now has a satisfying display.
hamidouk
parents: 731
diff changeset
    62
  var pixels = Math.floor(this.selector.width() * percents);
471
af5b1db6fd0b center the slider exactly under the other position markers.
hamidouk
parents: 469
diff changeset
    63
  var positionMarker_width = this.positionMarker.width();
739
d28b9acfc445 moved the sliderWidget from percents to pixels. It now has a satisfying display.
hamidouk
parents: 731
diff changeset
    64
  var correction = (positionMarker_width / 2);
471
af5b1db6fd0b center the slider exactly under the other position markers.
hamidouk
parents: 469
diff changeset
    65
731
e02f43299022 do some boundaries checks.
hamidouk
parents: 488
diff changeset
    66
  /* check that we don't leave the left side */
739
d28b9acfc445 moved the sliderWidget from percents to pixels. It now has a satisfying display.
hamidouk
parents: 731
diff changeset
    67
  var newPos = pixels - correction;
471
af5b1db6fd0b center the slider exactly under the other position markers.
hamidouk
parents: 469
diff changeset
    68
  if (newPos <= 0)
af5b1db6fd0b center the slider exactly under the other position markers.
hamidouk
parents: 469
diff changeset
    69
    newPos = 0;
af5b1db6fd0b center the slider exactly under the other position markers.
hamidouk
parents: 469
diff changeset
    70
  
731
e02f43299022 do some boundaries checks.
hamidouk
parents: 488
diff changeset
    71
  /* check that we don't leave the right side */
739
d28b9acfc445 moved the sliderWidget from percents to pixels. It now has a satisfying display.
hamidouk
parents: 731
diff changeset
    72
  var rightEdgePos = pixels + 1 * correction;
d28b9acfc445 moved the sliderWidget from percents to pixels. It now has a satisfying display.
hamidouk
parents: 731
diff changeset
    73
d28b9acfc445 moved the sliderWidget from percents to pixels. It now has a satisfying display.
hamidouk
parents: 731
diff changeset
    74
  if (rightEdgePos >= divWidth)
d28b9acfc445 moved the sliderWidget from percents to pixels. It now has a satisfying display.
hamidouk
parents: 731
diff changeset
    75
    newPos = divWidth - 1 * correction - 1;
731
e02f43299022 do some boundaries checks.
hamidouk
parents: 488
diff changeset
    76
  
740
3b60f3beb521 forgot debug printf.
hamidouk
parents: 739
diff changeset
    77
  this.sliderForeground.css("width", pixels + "px");
3b60f3beb521 forgot debug printf.
hamidouk
parents: 739
diff changeset
    78
  this.positionMarker.css("left", newPos + "px");
289
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
    79
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
    80
};
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
    81
330
156ea1d74223 fixed a bug where clicks on the slider foreground would not be taken into account.
hamidouk
parents: 329
diff changeset
    82
IriSP.SliderWidget.prototype.backgroundClickHandler = function(event) {
289
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
    83
  /* this piece of code is a little bit convoluted - here's how it works :
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
    84
     we want to handle clicks on the progress bar and convert those to seeks in the media.
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
    85
     However, jquery only gives us a global position, and we want a number of pixels relative
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
    86
     to our container div, so we get the parent position, and compute an offset to this position,
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
    87
     and finally compute the progress ratio in the media.
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
    88
     Finally we multiply this ratio with the duration to get the correct time
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
    89
  */
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
    90
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
    91
  var parentOffset = this.sliderBackground.parent().offset();
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
    92
  var width = this.sliderBackground.width();
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
    93
  var relX = event.pageX - parentOffset.left;
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
    94
820
7968346b9689 Added compatibility with cinecast format (with get_aliased)
veltr
parents: 740
diff changeset
    95
  var duration = this._serializer.getDuration() / 1000;
289
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
    96
  var newTime = ((relX / width) * duration).toFixed(2);
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
    97
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
    98
  this._Popcorn.currentTime(newTime);
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
    99
};
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
   100
330
156ea1d74223 fixed a bug where clicks on the slider foreground would not be taken into account.
hamidouk
parents: 329
diff changeset
   101
/* same function as the previous one, except that it handles clicks
156ea1d74223 fixed a bug where clicks on the slider foreground would not be taken into account.
hamidouk
parents: 329
diff changeset
   102
   on the foreground element */
156ea1d74223 fixed a bug where clicks on the slider foreground would not be taken into account.
hamidouk
parents: 329
diff changeset
   103
IriSP.SliderWidget.prototype.foregroundClickHandler = function(event) {
156ea1d74223 fixed a bug where clicks on the slider foreground would not be taken into account.
hamidouk
parents: 329
diff changeset
   104
  var parentOffset = this.sliderForeground.parent().offset();
156ea1d74223 fixed a bug where clicks on the slider foreground would not be taken into account.
hamidouk
parents: 329
diff changeset
   105
  var width = this.sliderBackground.width();
156ea1d74223 fixed a bug where clicks on the slider foreground would not be taken into account.
hamidouk
parents: 329
diff changeset
   106
  var relX = event.pageX - parentOffset.left;
156ea1d74223 fixed a bug where clicks on the slider foreground would not be taken into account.
hamidouk
parents: 329
diff changeset
   107
820
7968346b9689 Added compatibility with cinecast format (with get_aliased)
veltr
parents: 740
diff changeset
   108
  var duration = this._serializer.getDuration() / 1000;
330
156ea1d74223 fixed a bug where clicks on the slider foreground would not be taken into account.
hamidouk
parents: 329
diff changeset
   109
  var newTime = ((relX / width) * duration).toFixed(2);
156ea1d74223 fixed a bug where clicks on the slider foreground would not be taken into account.
hamidouk
parents: 329
diff changeset
   110
156ea1d74223 fixed a bug where clicks on the slider foreground would not be taken into account.
hamidouk
parents: 329
diff changeset
   111
  this._Popcorn.currentTime(newTime);
156ea1d74223 fixed a bug where clicks on the slider foreground would not be taken into account.
hamidouk
parents: 329
diff changeset
   112
};
156ea1d74223 fixed a bug where clicks on the slider foreground would not be taken into account.
hamidouk
parents: 329
diff changeset
   113
289
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
   114
/* handles mouse over the slider */
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
   115
IriSP.SliderWidget.prototype.mouseOverHandler = function(event) {
347
9c55d584d3a9 slider maximization when rolled over now works.
hamidouk
parents: 332
diff changeset
   116
  
9c55d584d3a9 slider maximization when rolled over now works.
hamidouk
parents: 332
diff changeset
   117
  if (this.timeOutId !== null) {
9c55d584d3a9 slider maximization when rolled over now works.
hamidouk
parents: 332
diff changeset
   118
    window.clearTimeout(this.timeOutId);
9c55d584d3a9 slider maximization when rolled over now works.
hamidouk
parents: 332
diff changeset
   119
  }
9c55d584d3a9 slider maximization when rolled over now works.
hamidouk
parents: 332
diff changeset
   120
 
9c55d584d3a9 slider maximization when rolled over now works.
hamidouk
parents: 332
diff changeset
   121
  this.sliderMaximized = true;
9c55d584d3a9 slider maximization when rolled over now works.
hamidouk
parents: 332
diff changeset
   122
329
d37ca170cdb2 added a one pixel margin to the slider widget for readability.
hamidouk
parents: 324
diff changeset
   123
  this.sliderBackground.animate({"height": "9px"}, 100);
d37ca170cdb2 added a one pixel margin to the slider widget for readability.
hamidouk
parents: 324
diff changeset
   124
  this.sliderForeground.animate({"height": "9px"}, 100);
476
3957157b7f96 slight change.
hamidouk
parents: 472
diff changeset
   125
  this.positionMarker.animate({"height": "9px", "width": "9px"}, 100);
481
a46cfeee6d77 using jquery ui draggable changes the state of an element from absolute to relative
hamidouk
parents: 476
diff changeset
   126
  //this.positionMarker.css("margin-top", "-4px");
324
abe961b7f295 a slider that more or less works.
hamidouk
parents: 322
diff changeset
   127
  
abe961b7f295 a slider that more or less works.
hamidouk
parents: 322
diff changeset
   128
//  this.selector.removeClass("Ldt-SliderMinimized");
abe961b7f295 a slider that more or less works.
hamidouk
parents: 322
diff changeset
   129
//  this.selector.addClass("Ldt-SliderMaximized");
289
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
   130
};
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
   131
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
   132
/* handles when the mouse leaves the slider */
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
   133
IriSP.SliderWidget.prototype.mouseOutHandler = function(event) {
372
33a435f35597 added an option to tweak the speed with which a sliderWidget minimizes itself.
hamidouk
parents: 347
diff changeset
   134
33a435f35597 added an option to tweak the speed with which a sliderWidget minimizes itself.
hamidouk
parents: 347
diff changeset
   135
  this.timeOutId = window.setTimeout(IriSP.wrap(this, this.minimizeOnTimeout),
33a435f35597 added an option to tweak the speed with which a sliderWidget minimizes itself.
hamidouk
parents: 347
diff changeset
   136
                                     IriSP.widgetsDefaults.SliderWidget.minimize_period);
347
9c55d584d3a9 slider maximization when rolled over now works.
hamidouk
parents: 332
diff changeset
   137
};
9c55d584d3a9 slider maximization when rolled over now works.
hamidouk
parents: 332
diff changeset
   138
9c55d584d3a9 slider maximization when rolled over now works.
hamidouk
parents: 332
diff changeset
   139
IriSP.SliderWidget.prototype.minimizeOnTimeout = function(event) {
324
abe961b7f295 a slider that more or less works.
hamidouk
parents: 322
diff changeset
   140
  this.sliderBackground.animate({"height": "5px"}, 100);
abe961b7f295 a slider that more or less works.
hamidouk
parents: 322
diff changeset
   141
  this.sliderForeground.animate({"height": "5px"}, 100);
476
3957157b7f96 slight change.
hamidouk
parents: 472
diff changeset
   142
  this.positionMarker.animate({"height": "5px", "width": "5px"}, 100);
3957157b7f96 slight change.
hamidouk
parents: 472
diff changeset
   143
  this.positionMarker.css("margin-top", "0px");
347
9c55d584d3a9 slider maximization when rolled over now works.
hamidouk
parents: 332
diff changeset
   144
  this.sliderMinimized = true;
324
abe961b7f295 a slider that more or less works.
hamidouk
parents: 322
diff changeset
   145
  
abe961b7f295 a slider that more or less works.
hamidouk
parents: 322
diff changeset
   146
//  this.selector.removeClass("Ldt-SliderMaximized");
abe961b7f295 a slider that more or less works.
hamidouk
parents: 322
diff changeset
   147
//  this.selector.addClass("Ldt-SliderMinimized");
abe961b7f295 a slider that more or less works.
hamidouk
parents: 322
diff changeset
   148
289
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
   149
};
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
   150
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
   151
// called when the user starts dragging the position indicator
472
1da76db24aa8 fixed stupid && bug.
hamidouk
parents: 471
diff changeset
   152
IriSP.SliderWidget.prototype.positionMarkerDraggingStartedHandler = function(event, ui) {  
289
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
   153
  this.draggingOngoing = true;
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
   154
};
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
   155
488
ab73470647cb fixed seeking bug and jerky scrolling.
hamidouk
parents: 481
diff changeset
   156
IriSP.SliderWidget.prototype.positionMarkerDraggedHandler = function(event, ui) {   
472
1da76db24aa8 fixed stupid && bug.
hamidouk
parents: 471
diff changeset
   157
  this._disableUpdate = true; // disable slider position updates while dragging is ongoing.
1da76db24aa8 fixed stupid && bug.
hamidouk
parents: 471
diff changeset
   158
  window.setTimeout(IriSP.wrap(this, function() { this._disableUpdate = false; }), 500);
488
ab73470647cb fixed seeking bug and jerky scrolling.
hamidouk
parents: 481
diff changeset
   159
ab73470647cb fixed seeking bug and jerky scrolling.
hamidouk
parents: 481
diff changeset
   160
  var parentOffset = this.sliderForeground.parent().offset();
289
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
   161
  var width = this.sliderBackground.width();
488
ab73470647cb fixed seeking bug and jerky scrolling.
hamidouk
parents: 481
diff changeset
   162
  var relX = event.pageX - parentOffset.left;
ab73470647cb fixed seeking bug and jerky scrolling.
hamidouk
parents: 481
diff changeset
   163
820
7968346b9689 Added compatibility with cinecast format (with get_aliased)
veltr
parents: 740
diff changeset
   164
  var duration = this._serializer.getDuration() / 1000;
488
ab73470647cb fixed seeking bug and jerky scrolling.
hamidouk
parents: 481
diff changeset
   165
  var newTime = ((relX / width) * duration).toFixed(2);
289
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
   166
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
   167
  this._Popcorn.currentTime(newTime);
488
ab73470647cb fixed seeking bug and jerky scrolling.
hamidouk
parents: 481
diff changeset
   168
  
289
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
   169
  this.draggingOngoing = false;
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
   170
};
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 260
diff changeset
   171