Commit d56d70e9 authored by Tomas Pettersson's avatar Tomas Pettersson 🏸
Browse files

progress fixed

parent 0a8b80a2
......@@ -30,7 +30,7 @@
.player-play-progress {
font-size: 12px;
position: relative;
left: -2px;
left: -6px;
}
......
......@@ -58,6 +58,10 @@ var L;
L.DomEvent.disableClickPropagation(this.container);
return this.container;
};
Player.prototype.onRemove = function (map) {
var self = this;
self.player.off('waiting', self.onPlayerWaiting, this);
};
Player.prototype.setup = function () {
var self = this;
self.addLayout();
......@@ -66,7 +70,6 @@ var L;
});
self.timeDimension.on('timeload', function (time) {
self.enable();
self.playForwardIcon.innerHTML = "";
});
self.player = new L.TimeDimension.Player({
transitionTime: self.transitionTime,
......@@ -83,10 +86,11 @@ var L;
self.playForwardIcon.innerHTML = '<span class="player-play-progress">' + Math.floor(evt.available / evt.buffer * 100) + '%</span>';
;
}
// if (this._buttonPlayReversePause && this._player.getSteps() < 0) {
// L.DomUtil.addClass(this._buttonPlayReversePause, 'loading');
// this._buttonPlayReversePause.innerHTML = this._getDisplayLoadingText(evt.available, evt.buffer);
// }
if (self.player.getSteps() < 0) {
self.playBackwardIcon.classList.remove('uk-icon-pause');
self.playBackwardIcon.innerHTML = '<span class="player-play-progress">' + Math.floor(evt.available / evt.buffer * 100) + '%</span>';
;
}
};
Player.prototype.getTimeDimension = function () {
return this.timeDimension;
......@@ -181,10 +185,10 @@ var L;
},
onChange: function (data) {
var date = moment(data.from * 1000).utc();
self.timeDimension.setCurrentTime(date.valueOf());
self.timeSelect.value = date.format("X");
},
onFinish: function (data) {
self.disable();
var date = moment(data.from * 1000).utc();
self.timeDimension.setCurrentTime(date.valueOf());
self.timeSelect.value = date.format("X");
......@@ -208,15 +212,25 @@ var L;
var stepEndIcon = L.DomUtil.create('span', 'uk-icon-step-forward', stepEnd);
// var calendarDiv = <HTMLDivElement>L.DomUtil.create('div', 'player-calendar', controls);
// var calendar = <HTMLButtonElement>L.DomUtil.create('button', 'uk-icon-button uk-icon-calendar', calendarDiv);
var playUpdate = function () {
var playUpdate = function (forward) {
var date = moment(self.timeDimension.getCurrentTime()).utc();
self.timeSelect.value = date.format("X");
self.slider.update({
from: +date.format("X")
});
if (self.player.getSteps() > 0) {
self.playForwardIcon.innerHTML = "";
self.playForwardIcon.classList.add('uk-icon-pause');
}
else {
self.playBackwardIcon.innerHTML = "";
self.playBackwardIcon.classList.add('uk-icon-pause');
}
};
var stopPlay = function () {
if (self.player.isPlaying()) {
self.playBackwardIcon.innerHTML = "";
self.playForwardIcon.innerHTML = "";
self.playForwardIcon.classList.remove('uk-icon-pause');
self.playForwardIcon.classList.add('uk-icon-play');
self.playBackwardIcon.classList.remove('uk-icon-pause');
......
......@@ -75,6 +75,11 @@ export class Player extends L.Control {
return this.container;
}
public onRemove(map) {
var self = this;
self.player.off('waiting', self.onPlayerWaiting, this);
}
private setup() {
var self = this;
self.addLayout();
......@@ -84,7 +89,6 @@ export class Player extends L.Control {
});
self.timeDimension.on('timeload', function(time) {
self.enable();
self.playForwardIcon.innerHTML ="";
});
self.player = new L.TimeDimension.Player({
transitionTime : self.transitionTime,
......@@ -94,7 +98,6 @@ export class Player extends L.Control {
}, self.timeDimension);
self.player.on('waiting', self.onPlayerWaiting, this);
}
private onPlayerWaiting(evt) {
......@@ -103,10 +106,10 @@ export class Player extends L.Control {
self.playForwardIcon.classList.remove('uk-icon-pause');
self.playForwardIcon.innerHTML = '<span class="player-play-progress">' + Math.floor(evt.available / evt.buffer * 100) + '%</span>';;
}
// if (this._buttonPlayReversePause && this._player.getSteps() < 0) {
// L.DomUtil.addClass(this._buttonPlayReversePause, 'loading');
// this._buttonPlayReversePause.innerHTML = this._getDisplayLoadingText(evt.available, evt.buffer);
// }
if (self.player.getSteps() < 0) {
self.playBackwardIcon.classList.remove('uk-icon-pause');
self.playBackwardIcon.innerHTML = '<span class="player-play-progress">' + Math.floor(evt.available / evt.buffer * 100) + '%</span>';;
}
}
public getTimeDimension() {
......@@ -206,10 +209,10 @@ export class Player extends L.Control {
},
onChange: function (data) {
var date = moment(data.from*1000).utc();
self.timeDimension.setCurrentTime(date.valueOf());
self.timeSelect.value = date.format("X");
},
onFinish: function (data) {
self.disable();
var date = moment(data.from*1000).utc();
self.timeDimension.setCurrentTime(date.valueOf());
self.timeSelect.value = date.format("X");
......@@ -235,16 +238,25 @@ export class Player extends L.Control {
// var calendarDiv = <HTMLDivElement>L.DomUtil.create('div', 'player-calendar', controls);
// var calendar = <HTMLButtonElement>L.DomUtil.create('button', 'uk-icon-button uk-icon-calendar', calendarDiv);
var playUpdate = function() {
var playUpdate = function(forward) {
var date = moment(self.timeDimension.getCurrentTime()).utc();
self.timeSelect.value = date.format("X");
self.slider.update({
from : +date.format("X")
})
})
if (self.player.getSteps() > 0) {
self.playForwardIcon.innerHTML = "";
self.playForwardIcon.classList.add('uk-icon-pause');
} else {
self.playBackwardIcon.innerHTML = "";
self.playBackwardIcon.classList.add('uk-icon-pause');
}
}
var stopPlay = function() {
if (self.player.isPlaying()) {
self.playBackwardIcon.innerHTML = "";
self.playForwardIcon.innerHTML = "";
self.playForwardIcon.classList.remove('uk-icon-pause');
self.playForwardIcon.classList.add('uk-icon-play');
self.playBackwardIcon.classList.remove('uk-icon-pause');
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment