-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Timestamps and time durations are changed to be of type 'bigint' instead of 'number'. This is done to avoid loss of precision in JavaScript 'number' type for values above Number.MAX_SAFE_INTEGER (2^53 - 1). The class BIMath is added to provide some BigInt math utility functions. The method TimeGraphLayer.getPixels() is renamed to getPixel() since it returns only one value. In the time graph axis, fractional scale steps 1.5 and 2.5 are removed to avoid non-equidistant ticks when zoomed in to nanosecond level, due to BigInt integer rounding. The minimum view range is set to 2 ns, to be able to zoom out of it and to always have at least one time graph axis tick fully visible. Make the minimum pan offset 1 ns when using keyboard 'A' or 'D' or Shift-mouse wheel, for when the requested pixel offset represents less than a nanosecond. Refactor Ctrl+mouse drag horizontal panning to use the original start position since the relative offset at each mouse move event can be less than a nanosecond, preventing the panning. Signed-off-by: Patrick Tasse <patrick.tasse@ericsson.com>
- Loading branch information
1 parent
bbc0569
commit ed4042e
Showing
20 changed files
with
225 additions
and
205 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
export class BIMath { | ||
|
||
static readonly round = (val: bigint | number): bigint => { | ||
return typeof val === 'bigint' ? val : BigInt(Math.round(val)); | ||
}; | ||
|
||
static readonly clamp = (val: bigint | number, min: bigint, max: bigint): bigint => { | ||
val = BIMath.round(val); | ||
if (val < min) { | ||
return min; | ||
} else if (val > max) { | ||
return max; | ||
} | ||
return val; | ||
}; | ||
|
||
static readonly min = (val1: bigint | number, val2: bigint | number): bigint => { | ||
val1 = BIMath.round(val1); | ||
val2 = BIMath.round(val2); | ||
return val1 <= val2 ? val1 : val2; | ||
}; | ||
|
||
static readonly max = (val1: bigint | number, val2: bigint | number): bigint => { | ||
val1 = BIMath.round(val1); | ||
val2 = BIMath.round(val2); | ||
return val1 >= val2 ? val1 : val2; | ||
}; | ||
|
||
static readonly abs = (val: bigint | number): bigint => { | ||
val = BIMath.round(val); | ||
return val >= 0 ? val : -val; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.