Skip to content
Discussion options

You must be logged in to vote

I have managed to solve this.

All you have to do is to provide image with dimensions adjusted for scale factor, and enable image scaling by setting image-fit to fill, contain or cover.

Consider this example:

Image {
	width: floor(parent.width / 1px) * 1px;
	height: floor(parent.height / 1px) * 1px;
	image-fit: contain;
	source: Boards.render_board(
		board, 
		self.width * ScaleFactor.value,
		self.height * ScaleFactor.value,
		{ show_rulers: true }
	);
}

* ScaleFactor is global exported by my program, where value is set by rust code to represent SLINT_SCALE_FACTOR

Here, render_board callback returns an image with dimensions that are greater than element width and height by ScaleFactor.value

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Studiedlist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant