@babylonjs/controls
Advanced tools
Comparing version 1.0.0-alpha.13 to 1.0.0-alpha.14
@@ -57,3 +57,3 @@ import { EffectWrapper, EffectRenderer } from "@babylonjs/core/Materials/effectRenderer"; | ||
get maxSettableTime() { | ||
return this._totalDuration - this._visibleDuration; | ||
return Math.max(this._totalDuration - this._visibleDuration, 0); | ||
} | ||
@@ -150,7 +150,16 @@ /** | ||
const startTime = Math.floor(thumbnailIndex) * this._intervalDuration; | ||
// Computes a filler offsets for the width to ensure the timeline is centered. | ||
let filler = 0; | ||
if (this._totalDuration < this._visibleThumbnails) { | ||
const offset = this._visibleThumbnails - this._totalDuration; | ||
filler = offset / 2; | ||
} | ||
// Renders all the visible thumbnails in the timeline. | ||
for (let i = 0; i < this._visibleThumbnails + 1; i++) { | ||
const time = startTime + this._intervalDuration * i; | ||
if (time >= this._totalDuration) { | ||
break; | ||
} | ||
// Set the texture corresponding to the current time. | ||
const texture = this._getTexture(Math.floor(time)); | ||
const texture = this._getTexture(time); | ||
this._effectWrapper.effect.setTexture("thumbnail", texture); | ||
@@ -160,3 +169,3 @@ // Computes the horizontal offset of the thumbnail dynamically by respecting | ||
// shaderOffset = offset * 2. - 1.; | ||
const widthOffset = (time - this._currentTime) / this._visibleDuration * 2 - 1; | ||
const widthOffset = ((time - this._currentTime) + filler) / this._visibleDuration * 2 - 1; | ||
this._effectWrapper.effect.setFloat2("offset", widthOffset, this._heightOffset); | ||
@@ -248,3 +257,3 @@ this._effectWrapper.effect.setFloat2("scale", this._widthScale, this._heightScale); | ||
// Ensures the provided total duration is meaningful. | ||
this._totalDuration = Math.max(0, this._options.totalDuration); | ||
this._totalDuration = Math.floor(Math.max(0, this._options.totalDuration)); | ||
if (this._totalDuration === 0) { | ||
@@ -251,0 +260,0 @@ Logger.Error("The total duration can not be 0. Nothing would be displayed."); |
{ | ||
"name": "@babylonjs/controls", | ||
"version": "1.0.0-alpha.13", | ||
"version": "1.0.0-alpha.14", | ||
"description": "Babylon.js controls are a set of regular web controls that used hardware accelerated rendering through Babylon.js to provide blazing fast dedicated controls.", | ||
@@ -5,0 +5,0 @@ "author": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
133313
1229