Skip to content

Commit

Permalink
Fix Windows bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
jwbonner committed Nov 21, 2021
1 parent e83c93f commit 02268ec
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 21 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
On Linux, the GTK theme will now only be modified when running in dark mode. This means that for users with themes other than Adwaita, the UI should appear more consistent in light mode..
Bug fixes to improve the experience on Windows:
* When auto zooming out while live logging, the user can now exit properly.
* The sizes of the preferences and edit axis windows are fixed (again).
* The description of ".rlog" files in File Explorer has been shorted.
6 changes: 3 additions & 3 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ function setupMenu() {
},
{
label: "Close Tab",
accelerator: "CmdOrCtrl+W",
accelerator: isMac ? "Cmd+W" : "Ctrl+Q",
click() {
BrowserWindow.getFocusedWindow().webContents.send("tab-command", "close", null)
}
Expand Down Expand Up @@ -448,7 +448,7 @@ function openPreferences() {
return
}
const width = 400
const height = 170
const height = process.platform == "win32" ? 222 : 162 // "useContentSize" is broken on Windows when not resizable
prefsWindow = new BrowserWindow({
width: width,
height: height,
Expand Down Expand Up @@ -563,7 +563,7 @@ ipcMain.on("edit-axis", (_, data) => {
// Create edit axis window
const editWindow = new BrowserWindow({
width: 300,
height: 110,
height: process.platform == "win32" ? 125 : 108, // "useContentSize" is broken on Windows when not resizable
useContentSize: true,
resizable: false,
icon: iconPath,
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "advantage-scope",
"productName": "Advantage Scope",
"version": "1.5.1",
"version": "1.5.2",
"description": "Logging tool from FRC Team 6328.",
"main": "main.js",
"scripts": {
Expand Down Expand Up @@ -31,7 +31,7 @@
{
"ext": "rlog",
"name": "Robot log",
"description": "Log file for an FRC robot.",
"description": "Robot log",
"mimeType": "application/octet-stream",
"role": "Viewer",
"icon": "assets/rlog-icon"
Expand Down
26 changes: 13 additions & 13 deletions www/modules/tabControllers/lineGraphController.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ export class LineGraphController {

// Standard function: updates based on new live data
updateLive() {
this.#updateScroll(this.#maxScrollVert)
this.#updateScroll()
}

// Called by tab controller when side bar size changes
Expand Down Expand Up @@ -362,14 +362,24 @@ export class LineGraphController {
var timeRange = [log.getTimestamps()[0], log.getTimestamps()[log.getTimestamps().length - 1]]
}

// Check if at limits
this.#maxScrollVert = Math.ceil(this.#scrollOverlay.scrollTop) >= Math.floor(this.#scrollOverlay.scrollHeight - this.#scrollOverlay.clientHeight) - 1
this.#maxScrollHorz = Math.ceil(this.#scrollOverlay.scrollLeft) >= Math.floor(this.#scrollOverlay.scrollWidth - this.#scrollOverlay.clientWidth) - 1
if (selection.isLocked()) {
this.#maxScrollVert = false // Disable auto zoom while locked
}
if (log) {
if (log.getTimestamps().length < 10) this.#maxScrollVert = true // Lock to max zoom until log is of reasonable length
}

// Calculate maximum scroll lengths
var scrollLengthVertical = this.#calcReverseZoom(timeRange[1] - timeRange[0]) // Calc maximum zoom based on time range
var scrollLengthHorizontal = this.#scrollOverlay.clientWidth * ((timeRange[1] - timeRange[0]) / this.#calcZoom()) // Calc horizontal length based on zoom

// Adjust content size and enforce limits
this.#scrollOverlayContent.style.height = (scrollLengthVertical + this.#scrollOverlay.clientHeight).toString() + "px"
this.#scrollOverlayContent.style.width = scrollLengthHorizontal.toString() + "px"
if (reset || platform != this.#lastPlatform) {
if (reset || platform != this.#lastPlatform || this.#maxScrollVert) {
this.#lastPlatform = platform
this.#scrollOverlay.scrollTop = scrollLengthVertical
this.#scrollOverlay.scrollLeft = 0
Expand Down Expand Up @@ -404,16 +414,6 @@ export class LineGraphController {
var minX = ((this.#scrollOverlay.scrollLeft / this.#scrollOverlay.clientWidth) * this.#calcZoom()) + timeRange[0]
this.#xRange = [minX, minX + this.#calcZoom()]
this.#lastScrollTop = this.#scrollOverlay.scrollTop

// Check if at limits
this.#maxScrollVert = Math.ceil(this.#scrollOverlay.scrollTop) >= Math.floor(scrollLengthVertical) - 5
this.#maxScrollHorz = Math.ceil(this.#scrollOverlay.scrollLeft) == Math.floor(scrollLengthHorizontal)
if (selection.isLocked()) {
this.#maxScrollVert = false // Disable auto zoom while locked
}
if (log) {
if (log.getTimestamps().length < 10) this.#maxScrollVert = true // Lock to max zoom until log is of reasonable length}
}
}

// Cleans up floating point errors
Expand Down Expand Up @@ -501,7 +501,7 @@ export class LineGraphController {
// Called every 15ms by the tab controller
periodic() {
// Reset scroll if queued
if (this.#resetOnNextUpdate || this.#maxScrollVert) {
if (this.#resetOnNextUpdate) {
this.#resetOnNextUpdate = false
this.#updateScroll(true)
} else if (selection.isLocked()) { // Update every cycle when locked to ensure smoothness
Expand Down
11 changes: 9 additions & 2 deletions www/prompts.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,16 @@ table {
top: 10px;
left: 10px;
width: calc(100% - 20px);
border-spacing: 0px;
}

tr {
line-height: 25px;
line-height: 27px;
}

td {
margin: 0px;
padding: 0px;
}

td.label {
Expand All @@ -29,7 +35,8 @@ td.label {
input, select {
box-sizing: border-box;
display: block;
width: 100%;
margin-left: 5px;
width: calc(100% - 5px);
}

button {
Expand Down

0 comments on commit 02268ec

Please sign in to comment.