mirror of
https://github.com/elementary/gala.git
synced 2024-11-23 20:07:21 +03:00
IconGroup: Refactor the canvas resize logic
Move the code to resize the IconGroup canvas to a funtion to be able to reuse it. Refactor, no functional changes.
This commit is contained in:
parent
dce79fdf2e
commit
ab351ea321
@ -96,17 +96,12 @@ namespace Gala {
|
||||
}
|
||||
|
||||
construct {
|
||||
var scale = InternalUtils.get_ui_scaling_factor ();
|
||||
var size = SIZE * scale;
|
||||
|
||||
width = size;
|
||||
height = size;
|
||||
reactive = true;
|
||||
|
||||
var canvas = new Canvas ();
|
||||
canvas.set_size (size, size);
|
||||
canvas.draw.connect (draw);
|
||||
content = canvas;
|
||||
resize_canvas ();
|
||||
|
||||
dummy_material = new Cogl.Material ();
|
||||
|
||||
@ -202,6 +197,16 @@ namespace Gala {
|
||||
close_button.visible = false;
|
||||
}
|
||||
|
||||
bool resize_canvas () {
|
||||
var scale = InternalUtils.get_ui_scaling_factor ();
|
||||
var size = SIZE * scale;
|
||||
|
||||
width = size;
|
||||
height = size;
|
||||
|
||||
return ((Canvas) content).set_size (size, size);
|
||||
}
|
||||
|
||||
/**
|
||||
* Override the paint handler to draw our backdrop if necessary
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user