Skip to content

Commit

Permalink
fix: factor in monitor scaling for application library (#277)
Browse files Browse the repository at this point in the history
This addresses the problem where the application library is too large
when a scaling factor is applied.

To fix this, we get the scale factor and apply to the height and width:

    monitorScale = 1/St.ThemeContext.get_for_stage(global.stage).scale_factor;
    height = Math.floor(monitorScale*monitor.height*.5 / 168) * 168
    width = Math.ceil(monitorScale*monitor.width*.6 / 168) * 168

Fixes #290.
  • Loading branch information
pbui authored Jan 14, 2022
1 parent 73b0c61 commit f81ab36
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions applications.js
Original file line number Diff line number Diff line change
Expand Up @@ -1148,10 +1148,11 @@ var CosmicAppsDialog = GObject.registerClass({

// Resize Scroll View in App Display based on monitor dimensions
const monitor = this.monitor();
const height = Math.floor(monitor.height*.5 / 168) * 168;
const width = Math.ceil(monitor.width*.6 / 168) * 168;
this.appDisplay.resize(height, width);
const monitorScale = 1/St.ThemeContext.get_for_stage(global.stage).scale_factor;
const height = Math.floor(monitorScale*monitor.height*.5 / 168) * 168;
const width = Math.ceil(monitorScale*monitor.width*.6 / 168) * 168;

this.appDisplay.resize(height, width);
this.appDisplay.reset();

// Update 'checked' state of Applications button
Expand Down

0 comments on commit f81ab36

Please sign in to comment.