mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2024-11-26 10:49:17 +00:00
verilog: scope view go to current position, no more scrolling
This commit is contained in:
parent
f8532b44aa
commit
4a916b88e3
@ -34,6 +34,7 @@ export class WaveformView {
|
|||||||
zoom : number = 8;
|
zoom : number = 8;
|
||||||
t0 : number = 0;
|
t0 : number = 0;
|
||||||
tsel : number = -1;
|
tsel : number = -1;
|
||||||
|
tnow : number = -1;
|
||||||
pageWidth : number;
|
pageWidth : number;
|
||||||
clocksPerPage : number;
|
clocksPerPage : number;
|
||||||
clockMax : number;
|
clockMax : number;
|
||||||
@ -161,6 +162,10 @@ export class WaveformView {
|
|||||||
this.toolbar.add('shift+right', 'Move right 1/4 page', 'glyphicon-fast-forward', (e,combo) => {
|
this.toolbar.add('shift+right', 'Move right 1/4 page', 'glyphicon-fast-forward', (e,combo) => {
|
||||||
this.setSelTime(this.tsel + this.clocksPerPage/4);
|
this.setSelTime(this.tsel + this.clocksPerPage/4);
|
||||||
});
|
});
|
||||||
|
this.toolbar.add('space', 'Go to current time', 'glyphicon-flash', (e,combo) => {
|
||||||
|
this.setOrgTime(this.tnow);
|
||||||
|
this.setSelTime(this.tnow);
|
||||||
|
});
|
||||||
this.toolbar.add('h', 'Switch between hex/decimal format', 'glyphicon-barcode', (e,combo) => {
|
this.toolbar.add('h', 'Switch between hex/decimal format', 'glyphicon-barcode', (e,combo) => {
|
||||||
this.hexformat = !this.hexformat;
|
this.hexformat = !this.hexformat;
|
||||||
this.refresh();
|
this.refresh();
|
||||||
@ -181,11 +186,12 @@ export class WaveformView {
|
|||||||
this.t0 = this.roundT(t);
|
this.t0 = this.roundT(t);
|
||||||
this.refresh();
|
this.refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
setEndTime(t : number) {
|
setCurrentTime(t : number) {
|
||||||
this.setOrgTime(t - this.clocksPerPage);
|
this.tnow = this.roundT(t);
|
||||||
|
this.refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
setSelTime(t : number) {
|
setSelTime(t : number) {
|
||||||
t = this.roundT(t);
|
t = this.roundT(t);
|
||||||
if (t >= this.t0 + this.clocksPerPage - 1)
|
if (t >= this.t0 + this.clocksPerPage - 1)
|
||||||
@ -302,6 +308,15 @@ export class WaveformView {
|
|||||||
ctx.fillText(s, x, ycen);
|
ctx.fillText(s, x, ycen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// draw current line
|
||||||
|
if (this.tnow >= this.t0) {
|
||||||
|
ctx.strokeStyle = ctx.fillStyle = "#6666cc";
|
||||||
|
ctx.beginPath();
|
||||||
|
x = (this.tnow - this.t0)*this.zoom + this.zoom/2;
|
||||||
|
ctx.moveTo(x, 0);
|
||||||
|
ctx.lineTo(x, h);
|
||||||
|
ctx.stroke();
|
||||||
|
}
|
||||||
// draw labels
|
// draw labels
|
||||||
ctx.fillStyle = "white";
|
ctx.fillStyle = "white";
|
||||||
ctx.textAlign = "left";
|
ctx.textAlign = "left";
|
||||||
|
@ -438,7 +438,7 @@ var VerilogPlatform = function(mainElement, options) {
|
|||||||
this.refreshVideoFrame();
|
this.refreshVideoFrame();
|
||||||
// set scope offset
|
// set scope offset
|
||||||
if (trace && this.waveview) {
|
if (trace && this.waveview) {
|
||||||
this.waveview.setEndTime(Math.floor(trace_index/trace_signals.length));
|
this.waveview.setCurrentTime(Math.floor(trace_index/trace_signals.length));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user