/**
 * @author centsent
 */
import directivesModule from '../../_index';

/**
 * @ngInject
 */
function hyTimePoint($hyMedia) {
  return {
    restrict: 'A',
    link($scope, elem) {
      elem.bind('click', event => event.stopPropagation());

      $hyMedia.onTimeUpdate((currentTime) => {
        const percentTime = currentTime / $hyMedia.totalTime * 100;
        elem.css('left', `${percentTime}%`);
      });
    }
  };
}

directivesModule.directive('hyTimePoint', hyTimePoint);

@@ -176,16 +176,114 @@
 elem) %7B%0A
+      const width = elem%5B0%5D.clientWidth;%0A      const parentWidth = elem.parent()%5B0%5D.clientWidth;%0A%0A
       el
@@ -363,17 +363,16 @@
 eUpdate(
-(
 currentT
@@ -378,15 +378,60 @@
 Time
-)
  =%3E %7B%0A
+        const totalTime = $hyMedia.totalTime;%0A
     
@@ -447,20 +447,20 @@
  percent
-Time
+Left
  = curre
@@ -468,34 +468,61 @@
 tTime / 
-$hyMedia.totalTime
+(totalTime + totalTime / parentWidth * width)
  * 100;%0A
@@ -556,20 +556,20 @@
 %7Bpercent
-Time
+Left
 %7D%25%60);%0A  

fix time point position