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

Scale won't work on HTML? #393

Closed
ghost opened this issue Sep 21, 2021 · 10 comments
Closed

Scale won't work on HTML? #393

ghost opened this issue Sep 21, 2021 · 10 comments

Comments

@ghost
Copy link

ghost commented Sep 21, 2021

(I'm not good at English and JavaScript.)
I'm trying to use this on my website, but scale seems doesn't work.

<!DOCTYPE html>
<html>
  <head>
    <script src="/scratch_blocks.js"></script>
  </head>
  <body>
    <p class="blocks">when green flag clicked</p>
    <span class="blocks">when green flag clicked</span>
    <script>scratchblocks.renderMatching("p.blocks", {style: "scratch3", scale: 1});scratchblocks.renderMatching("span.blocks", {style: "scratch3", scale: 1, inline: true})</script>
  </body>
</html>

out:
out

<!DOCTYPE html>
<html>
  <head>
    <script src="/scratch_blocks.js"></script>
  </head>
  <body>
    <p class="blocks">when green flag clicked</p>
    <span class="blocks">when green flag clicked</span>
    <script>scratchblocks.renderMatching("p.blocks", {style: "scratch3", scale: 0.675,});scratchblocks.renderMatching("span.blocks", {style: "scratch3", scale: 0.675, inline: true})</script>
  </body>
</html>

out still is:
out2
It haven't changed, why?
How can I fix it?

@tjvr
Copy link
Member

tjvr commented Sep 21, 2021

Which version of scratchblocks are you using?

@ghost
Copy link
Author

ghost commented Sep 22, 2021

Which version of scratchblocks are you using?

v3.5.2, latest version.

@apple502j
Copy link
Collaborator

scale is not in 3.5.2.

@ghost
Copy link
Author

ghost commented Sep 24, 2021

scale is not in 3.5.2.

So... README.md is too new?
Then how I change the scale in another way? It's really too large.

@CST1229
Copy link
Contributor

CST1229 commented Sep 24, 2021

So... README.md is too new?

It's not, the README is for the current state of the repo, which is not the current release. Essentially it's like a beta.

Then how I change the scale in another way? It's really too large.

You can try building scratchblocks yourself and using that, maybe.

@tjvr
Copy link
Member

tjvr commented Sep 24, 2021

I can upload a new version! I might wait until #389 is merged 👍

@CST1229
Copy link
Contributor

CST1229 commented Sep 24, 2021

I might wait until #389 is merged 👍

Speaking of merging PRs, what about #390?

@ghost
Copy link
Author

ghost commented Sep 25, 2021

It's not, the README is for the current state of the repo, which is not the current release. Essentially it's like a beta.

I see. Thank you.

@ajskateboarder
Copy link

ajskateboarder commented Oct 2, 2021

I found a temporary solution!
Once you render the scratchblock element, a div element is created with the SVG for the blocks inside. You can simply edit the width and height of the SVG like so:

let svgw = document.getElementsByTagName('svg').item(0).width.baseVal.value,
    svgh = document.getElementsByTagName('svg').item(0).height.baseVal.value

document.getElementsByTagName('svg').item(0).width.baseVal.value = svgw / 1.5
document.getElementsByTagName('svg').item(0).height.baseVal.value = svgh / 1.5

@tjvr
Copy link
Member

tjvr commented Mar 6, 2022

I've just published 3.6.0! See #403.

@tjvr tjvr closed this as completed Mar 6, 2022
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