Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Screen size measuring #1684

Open
DNin01 opened this issue Sep 14, 2024 · 4 comments
Open

Screen size measuring #1684

DNin01 opened this issue Sep 14, 2024 · 4 comments

Comments

@DNin01
Copy link
Collaborator

DNin01 commented Sep 14, 2024

Currently, projects can get the size of the window using Window Controls and the size of the entire display using Screen Resolution. But what if more information about the screen, window, and project player could be obtained through a single extension?

Here are all the interfaces we can use to get different size measurements, and some ideas for what we could call them:

API My term Access
🖥️ window.screen.width/height Display ✔️
🖼️ window.screen.availWidth/availHeight Desktop ✔️
🟦 outerWidth/outerHeight Window ✔️
📄 innerWidth/innerHeight Webpage 🛡️
📽️ Scratch.renderer.canvas.width/height Player 🛡️

And here's how I represent them visually:
A picture revealing the sizes of different elements on the screen

Which of these do you think would be useful for Scratch projects?

@CubesterYT
Copy link
Collaborator

image
This does exist in Window Controls, I still never understood the point of Screen Resolution standalone, considering it already concisely in Window Controls.

@Xeltalliv
Copy link
Contributor

Xeltalliv commented Sep 23, 2024

Good idea.

Scratch.renderer.canvas.width/height is technically already possible using of Simple3D + high quality pen, but it could be useful for many use cases without Simple3D, and importing Simple3D just for this would be a bloat
image

if (renderer.useHighQualityRender) {
canvas.width = renderer.canvas.width;
canvas.height = renderer.canvas.height;
} else {
canvas.width = this._nativeSize[0];
canvas.height = this._nativeSize[1];
}

{
opcode: "canvasWidth",
blockType: BlockType.REPORTER,
text: "stage width",
def: function () {
return canvas.width;
},
},
{
opcode: "canvasHeight",
blockType: BlockType.REPORTER,
text: "stage height",
def: function () {
return canvas.height;
},
},

@namelessisbackbutnottodobadthingsiswear

image This does exist in Window Controls, I still never understood the point of Screen Resolution standalone, considering it already concisely in Window Controls.

That's not what OP is asking for. In fact, they acknowledge in the original post that Window Controls has these blocks. What they're looking for is an extension that can detect the size of different parts of the screen, such as the project player, window, display/monitor, etc.

@CubesterYT
Copy link
Collaborator

image This does exist in Window Controls, I still never understood the point of Screen Resolution standalone, considering it already concisely in Window Controls.

That's not what OP is asking for. In fact, they acknowledge in the original post that Window Controls has these blocks. What they're looking for is an extension that can detect the size of different parts of the screen, such as the project player, window, display/monitor, etc.

No I understood that, I lamented about a different fact, that the blocks in the other listed extension also existed in WC. But whatever. Let's move on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants