# ggbApplet.setWidth/setHeight not always permanent

s_o shared this problem 4 years ago
Solved

I found out that sometimes when using "evalCommand" the size of the applet changes back to it's original dimensions when it had been modified using setWidth/setHeight/setSize.

Using JavaScript debugger I found out there is a huge callstack when the size is modified and the width value seems to be taken from:

R6g.a.i.vb.r.Ed.r.Zc.q.f._b.a.uc.g.gb.a.b

The value of that property does not change when calling setWidth/setHeight/setSize but keeps its original value. I assume this is a bug. This is really annoying me and I'm even willing to fix it, if no one else does it.

Is there a) a non-minimized JavaScript version of the GeoGebra-applet with meaningfull names?

b) A tutorial how to build one?

c) What is the official build process, so I can fix the bug at the right place and not in some generated JavaScript?

Best regards,

Stefan

Fixed for next release (v442)

1

Please post an example applet showing the problem

1

Here is a minimal example: https://www.geogebra.org/m/AEn2Etv2

This is the entire script, the disableAutoScale does not make a difference, it's just to prevent scaling in case the window is too small.

function ggbOnInit() {
parameters.disableAutoScale=true;
}

function enlarge() {
ggbApplet.setWidth(600);
ggbApplet.setHeight(600);
}

function change_text() {
ggbApplet.evalCommand("ftext = Text[\"\\frac{1}{4}=0.25\"]");
}

The problem can be reproduces easily:

Click "Make Bigger", the applet will be enlarged, then click "Change Text" and it will (partly) change back to its old size.

1

Your example works fine if embedded on its own page:

(changing the size on geogebra.org will interfere with other things, as you've discovered)

1

I'm sorry, but that is not the problem. I found out if right-click is enabled this bug is gone, when you tried you probably had different parameters for the applet. With right-click disabled it does not work, neither on geogebra.org, nor embedded. When right-click is enabled it works in both cases. I attached a minimal embed example for demonstration.

2

Sorry, you're right, we'll check

https://www.geogebra.org/m/yMKtWAMP

2

For now, you can try using SetValue() rather than = to change the text

2

Fixed for next release (v442)

2

(online now)

1

Thank you very much! Finally fullscreen works flawlessly without any workarounds:

https://www.geogebra.org/m/NHvm3kzM (press "Vollbild" in the upper left corner of the applet)

I tried SetTextValue before, but I could not never figure out how to use it with LaTeX.