mirror of
https://github.com/dataarts/dat.gui.git
synced 2024-12-12 04:08:27 +00:00
Improved scrubber rendering
This commit is contained in:
parent
7d9bc0ef96
commit
046ef1e1c8
@ -78,7 +78,7 @@ GUI.Scrubber = function(controller, timer) {
|
|||||||
|
|
||||||
// Draw playhead
|
// Draw playhead
|
||||||
|
|
||||||
_this.g.strokeStyle = "red";
|
_this.g.strokeStyle = "#ff0024";
|
||||||
_this.g.lineWidth = 1;
|
_this.g.lineWidth = 1;
|
||||||
var t = Math.round(GUI.map(_this.timer.playhead, _this.timer.windowMin, _this.timer.windowMin+_this.timer.windowWidth, 0, width))+0.5;
|
var t = Math.round(GUI.map(_this.timer.playhead, _this.timer.windowMin, _this.timer.windowMin+_this.timer.windowWidth, 0, width))+0.5;
|
||||||
_this.g.beginPath();
|
_this.g.beginPath();
|
||||||
@ -359,15 +359,40 @@ GUI.ScrubberPoint = function(scrubber, time, value) {
|
|||||||
y = scrubber.height/2;
|
y = scrubber.height/2;
|
||||||
|
|
||||||
if (scrubber.timer.activePoint == this) {
|
if (scrubber.timer.activePoint == this) {
|
||||||
g.fillStyle = "#fff"; //
|
g.fillStyle = "#ffd800"; //
|
||||||
} else if (scrubber.timer.hoverPoint == this) {
|
} else if (scrubber.timer.hoverPoint == this) {
|
||||||
g.fillStyle = "#ddd";
|
g.fillStyle = "#999";
|
||||||
} else {
|
} else {
|
||||||
g.fillStyle = "#ccc";
|
g.fillStyle = "#ccc";
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
|
||||||
|
case "boolean":
|
||||||
|
|
||||||
|
g.save();
|
||||||
|
|
||||||
|
g.translate(x, y-0.5);
|
||||||
|
|
||||||
|
if (this.value) {
|
||||||
|
|
||||||
|
g.strokeStyle = g.fillStyle;
|
||||||
|
g.lineWidth = barSize;
|
||||||
|
g.beginPath();
|
||||||
|
g.arc(0, 0, barSize, 0, Math.PI*2, false);
|
||||||
|
g.stroke();
|
||||||
|
} else {
|
||||||
|
|
||||||
|
g.rotate(Math.PI/4);
|
||||||
|
g.fillRect(-barSize/2, -barSize*3.5/2, barSize, barSize*3.5);
|
||||||
|
g.rotate(Math.PI/2);
|
||||||
|
g.fillRect(-barSize/2, -barSize*3.5/2, barSize, barSize*3.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
g.restore();
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
case "number":
|
case "number":
|
||||||
|
|
||||||
g.save();
|
g.save();
|
||||||
@ -377,9 +402,8 @@ GUI.ScrubberPoint = function(scrubber, time, value) {
|
|||||||
|
|
||||||
var nx = GUI.constrain(GUI.map(n.time, timer.windowMin, timer.windowMin+timer.windowWidth, 0, 1));
|
var nx = GUI.constrain(GUI.map(n.time, timer.windowMin, timer.windowMin+timer.windowWidth, 0, 1));
|
||||||
|
|
||||||
if (nx >= 0 && nx <= 1) {
|
nx = GUI.constrain(GUI.map(nx, 0, 1, 0, scrubber.width));
|
||||||
nx = Math.round(GUI.map(nx, 0, 1, 0, scrubber.width));
|
|
||||||
}
|
|
||||||
|
|
||||||
g.lineWidth = rectSize/2
|
g.lineWidth = rectSize/2
|
||||||
g.strokeStyle="#222";
|
g.strokeStyle="#222";
|
||||||
|
Loading…
Reference in New Issue
Block a user