feat: Enable 3D constructions when adapting Geometry Applet (#40)

Turns on 3D viewing only for the constructions that use a 3D primitive, but loads the more extensive web3d bundle from the embedded GeoGebra package whenever any applet on the page uses 3d. (The idea is to only require the loading of one bundle per page.) Provides progress on #36.

Reviewed-on: #40
Co-authored-by: Glen Whitney <glen@studioinfinity.org>
Co-committed-by: Glen Whitney <glen@studioinfinity.org>
This commit is contained in:
Glen Whitney 2023-10-08 17:10:59 +00:00 committed by Glen Whitney
parent c99b51dafa
commit 25ba69c621
29 changed files with 29236 additions and 59 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 B

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1 @@
$wnd.web3d.runAsyncCallback14("function Uyg(a){qpf.call(this,a)}\nfunction pDd(a){qDd.call(this,a,1.0E-11)}\nfunction $nd(a){Wnd(a,0,a.length,null)}\nfunction xWg(a,b){return new zXg(a.k,a,(Aij(),Fhj),b)}\nfunction IJf(a,b){var c,d;d=new snd;for(c=0;c<b.n.r.length;c++){bnd(d,fnd(b.n,c))}HJf(a,d)}\nfunction XKh(a,b,c){BYd();var d,e;d=Lbf(a.VU(),b.VU());e=Lbf(a.VU(),c.VU());return !taf(d,e)}\nfunction gLh(a,b,c,d,e,f,g,h){BYd();var i,j,k,l;i=a.VU();j=b.VU();k=c.VU();l=I9e(I9e(Aaf(T9e(i),d/g),j,e/g),k,f/g);h.AV(l,false)}\nfunction uCd(a,b,c){var d,e;vDd(a,b);e=a.b==null?0:a.b.length;if(c.length!=e){throw Ftc(new uDd(c.length,1,e,1))}for(d=0;d<e;++d){ECd(a,d,b,c[d])}}\nfunction vCd(a,b,c){var d,e;xDd(a,b);e=a.b==null||a.b[0]==null?0:a.b[0].length;if(c.length!=e){throw Ftc(new uDd(1,c.length,1,e))}for(d=0;d<e;++d){ECd(a,b,d,c[d])}}\nfunction sDd(a,b){var c,d,e,f,g,h,i;h=a.b.length;if(b.a.length!=h){throw Ftc(new oAd(b.a.length,h))}if(a.c){throw Ftc(new UDd)}c=me(tf,w2m,5,h,15,1);for(i=0;i<h;i++){c[i]=MCd(b,a.b[i])}for(f=0;f<h;f++){d=c[f];for(g=f+1;g<h;g++){c[g]-=d*a.a[g][f]}}for(e=h-1;e>=0;e--){c[e]/=a.a[e][e];d=c[e];for(g=0;g<e;g++){c[g]-=d*a.a[g][e]}}return new QCd(c)}\nfunction HJf(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,A,B,C,D,F,G,H;if(pf($wnd.Math.sqrt(9+8*b.r.length))!=$wnd.Math.sqrt(9+8*b.r.length)){a.o=false;wJf(a);return}d=pf(0.5*$wnd.Math.sqrt(8*(1+b.r.length)))-1;A=d;e=new HCd(b.r.length,b.r.length+1);t=new HCd(b.r.length,b.r.length);c=ke(tf,[Bbn,w2m],[20,5],15,[d+1,d+1],2);u=me(tf,w2m,5,b.r.length+1,15,1);for(g=0;g<b.r.length;g++){G=($wd(g,b.r.length),b.r[g]).WU();H=($wd(g,b.r.length),b.r[g]).XU();for(n=0,s=0;n<d+1;n++){for(r=0;n+r!=d+1;r++){u[s++]=$wnd.Math.pow(G,n)*$wnd.Math.pow(H,r)}}vCd(e,g,u)}D=0;v=b.r.length;do{if(D>v){v=v-A-1;if(v<2){a.o=false;wJf(a);return}e=new HCd(v,v+1);A-=1;u=me(tf,w2m,5,v+1,15,1);for(h=0;h<v;h++){G=($wd(h,b.r.length),b.r[h]).gV();H=($wd(h,b.r.length),b.r[h]).hV();for(n=0,s=0;n<A+1;n++){for(r=0;n+r!=A+1;r++){u[s++]=$wnd.Math.pow(G,n)*$wnd.Math.pow(H,r)}}vCd(e,h,u)}t=new HCd(v,v);D=0}B=tCd(e,D);for(i=0,o=0;i<v+1;i++){if(i==D){continue}uCd(t,o++,tCd(e,i))}++D;F=oDd(new pDd(t))}while(F.c);for(j=0;j<B.length;j++){B[j]*=-1}w=sDd(F,new PCd(B)).a;C=me(tf,w2m,5,w.length+1,15,1);for(k=0,p=0;k<C.length;k++){if(k==D-1){C[k]=1}else{C[k]=ynj(w[p])?0:w[p];++p}}for(l=0,q=0;l<A+1;l++){for(m=0;l+m<A+1;m++){c[l][m]=C[q++]}}yJf(a,c);a.o=true;for(f=0;f<b.r.length;f++){if(!uJf(a,($wd(f,b.r.length),b.r[f]))){a.o=false;wJf(a);return}}}\nvar C2n=')(',p4n=' and ',F4n={16:1,29:1,19:1,24:1,30:1,247:1},G4n={3:1,4:1,8:1,7:1,125:1},K4n={3:1,4:1,8:1,7:1,93:1};luc(F5m,1,{},pDd);luc(34,15,csn);_.UR=function(a,b){return this.K};luc(1677,25,Wrn);_.VP=function(a,b){var c;c=hpf(this,a,new Lrh(false));if(c.length!=1){throw Ftc(Zof(this,a,a.c.r.length))}if(!ff(c[0],49)){throw Ftc(Wof(this,a.i,c[0]))}return pe(ie(Zdb,1),fhn,15,0,[this.j_(c[0],Ktf(a))])};var cbb=Cgd(1677);luc(141,260,VEn);_.UR=function(a,b){return IYg(this,a,b)};luc(77,15,yGn);_.UR=function(a,b){if(cid(TCh(this,($qg(),wqg)),'y')){return NDh(this,b)}return !this.d?NaN:this.d.pk(a)};luc(185,15,BGn);_.UR=function(a,b){return lEh(this,a,b)};luc(c3m,1,{});var ekb=Cgd(c3m);dXm(Tc)(14);\n//# sourceURL=web3d-14.js\n")

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,23 @@
function web3d(){var H='bootstrap',I='begin',J='gwt.codesvr.web3d=',K='gwt.codesvr=',L='web3d',M='startup',N='DUMMY',O=0,P=1,Q='iframe',R='position:absolute; width:0; height:0; border:none; left: -1000px;',S=' top: -1000px;',T='Chrome',U='CSS1Compat',V='<!doctype html>',W='',X='<html><head><\/head><body><\/body><\/html>',Y='undefined',Z='readystatechange',$=10,_='script',ab='javascript',bb='Failed to load ',cb='moduleStartup',db='scriptTagAdded',eb='moduleRequested',fb='meta',gb='name',hb='web3d::',ib='::',jb='gwt:property',kb='content',lb='=',mb='gwt:onPropertyErrorFn',nb='Bad handler "',ob='" for "gwt:onPropertyErrorFn"',pb='gwt:onLoadErrorFn',qb='" for "gwt:onLoadErrorFn"',rb='#',sb='?',tb='/',ub='img',vb='clear.cache.gif',wb='baseUrl',xb='web3d.nocache.js',yb='base',zb='//',Ab='selectingPermutation',Bb='web3d.devmode.js',Cb='1ACC6399F984FD07A949D6F3D28D2FA3',Db=':',Eb='.cache.js',Fb='loadExternalRefs',Gb='end';var n=window;var o=document;q(H,I);function p(){var a=n.location.search;return a.indexOf(J)!=-1||a.indexOf(K)!=-1}
function q(a,b){if(n.__gwtStatsEvent){n.__gwtStatsEvent({moduleName:L,sessionId:n.__gwtStatsSessionId,subSystem:M,evtGroup:a,millis:(new Date).getTime(),type:b})}}
web3d.__sendStats=q;web3d.__moduleName=L;web3d.__errFn=null;web3d.__moduleBase=N;web3d.__softPermutationId=O;web3d.__computePropValue=null;web3d.__getPropMap=null;web3d.__installRunAsyncCode=function(){};web3d.__gwtStartLoadingFragment=function(){return null};web3d.__gwt_isKnownPropertyValue=function(){return false};web3d.__gwt_getMetaProperty=function(){return null};var r=null;var s=n.__gwt_activeModules=n.__gwt_activeModules||{};s[L]={moduleName:L};web3d.__moduleStartupDone=function(e){var f=s[L].bindings;s[L].bindings=function(){var a=f?f():{};var b=e[web3d.__softPermutationId];for(var c=O;c<b.length;c++){var d=b[c];a[d[O]]=d[P]}return a}};var t;function u(){v();return t}
function v(){if(t){return}var a=o.createElement(Q);a.id=L;a.style.cssText=R+S;a.tabIndex=-1;o.body.appendChild(a);t=a.contentWindow.document;if(navigator.userAgent.indexOf(T)==-1){t.open();var b=document.compatMode==U?V:W;t.write(b+X);t.close()}}
function w(f){function g(a){function b(){if(typeof o.readyState==Y){return typeof o.body!=Y&&o.body!=null}return /loaded|complete/.test(o.readyState)}
var c=b();if(c){a();return}function d(){if(!c){if(!b()){return}c=true;a();if(o.removeEventListener){o.removeEventListener(Z,d,false)}if(e){clearInterval(e)}}}
if(o.addEventListener){o.addEventListener(Z,d,false)}var e=setInterval(function(){d()},$)}
function h(a){var b=u();var c=b.body;var d=b.createElement(_);d.language=ab;d.crossOrigin=W;d.src=a;if(web3d.__errFn){d.onerror=function(){web3d.__errFn(L,new Error(bb+a))}}c.appendChild(d);q(cb,db)}
q(cb,eb);g(function(){h(f)})}
web3d.__startLoadingFragment=function(a){return C(a)};web3d.__installRunAsyncCode=function(a){var b=u();var c=b.body;var d=b.createElement(_);d.language=ab;d.text=a;c.appendChild(d);c.removeChild(d)};function A(){var c={};var d;var e;var f=o.getElementsByTagName(fb);for(var g=O,h=f.length;g<h;++g){var i=f[g],j=i.getAttribute(gb),k;if(j){j=j.replace(hb,W);if(j.indexOf(ib)>=O){continue}if(j==jb){k=i.getAttribute(kb);if(k){var l,m=k.indexOf(lb);if(m>=O){j=k.substring(O,m);l=k.substring(m+P)}else{j=k;l=W}c[j]=l}}else if(j==mb){k=i.getAttribute(kb);if(k){try{d=eval(k)}catch(a){alert(nb+k+ob)}}}else if(j==pb){k=i.getAttribute(kb);if(k){try{e=eval(k)}catch(a){alert(nb+k+qb)}}}}}__gwt_getMetaProperty=function(a){var b=c[a];return b==null?null:b};r=d;web3d.__errFn=e}
function B(){function e(a){var b=a.lastIndexOf(rb);if(b==-1){b=a.length}var c=a.indexOf(sb);if(c==-1){c=a.length}var d=a.lastIndexOf(tb,Math.min(c,b));return d>=O?a.substring(O,d+P):W}
function f(a){if(a.match(/^\w+:\/\//)){}else{var b=o.createElement(ub);b.src=a+vb;a=e(b.src)}return a}
function g(){var a=__gwt_getMetaProperty(wb);if(a!=null){return a}return W}
function h(){var a=o.getElementsByTagName(_);for(var b=O;b<a.length;++b){if(a[b].src.indexOf(xb)!=-1){return e(a[b].src)}}return W}
function i(){var a=o.getElementsByTagName(yb);if(a.length>O){return a[a.length-P].href}return W}
function j(){var a=o.location;return a.href==a.protocol+zb+a.host+a.pathname+a.search+a.hash}
var k=g();if(k==W){k=h()}if(k==W){k=i()}if(k==W&&j()){k=e(o.location.href)}k=f(k);return k}
function C(a){if(a.match(/^\//)){return a}if(a.match(/^[a-zA-Z]+:\/\//)){return a}return web3d.__moduleBase+a}
function D(){var f=[];var g=O;var h=[];var i=[];function j(a){var b=i[a](),c=h[a];if(b in c){return b}var d=[];for(var e in c){d[c[e]]=e}if(r){r(a,d,b)}throw null}
__gwt_isKnownPropertyValue=function(a,b){return b in h[a]};web3d.__getPropMap=function(){var a={};for(var b in h){if(h.hasOwnProperty(b)){a[b]=j(b)}}return a};web3d.__computePropValue=j;n.__gwt_activeModules[L].bindings=web3d.__getPropMap;q(H,Ab);if(p()){return C(Bb)}var k;try{k=Cb;var l=k.indexOf(Db);if(l!=-1){g=parseInt(k.substring(l+P),$);k=k.substring(O,l)}}catch(a){}web3d.__softPermutationId=g;return C(k+Eb)}
function F(){if(!n.__gwt_stylesLoaded){n.__gwt_stylesLoaded={}}q(Fb,I);q(Fb,Gb)}
A();web3d.__moduleBase=B();s[L].moduleBase=web3d.__moduleBase;var G=D();F();q(H,Gb);w(G);return true}
web3d.succeeded=web3d();

View file

@ -35,7 +35,16 @@
"deps/GeoGebra/HTML5/5.0/webSimple/webSimple.nocache.js",
"deps/GeoGebra/HTML5/5.0/webSimple/clear.cache.gif",
"deps/GeoGebra/HTML5/5.0/webSimple/deferredjs/*",
"deps/GeoGebra/HTML5/5.0/css/bundles/simple-bundle.css"
"deps/GeoGebra/HTML5/5.0/web3d/web3d.nocache.js",
"deps/GeoGebra/HTML5/5.0/web3d/clear.cache.gif",
"deps/GeoGebra/HTML5/5.0/web3d/1ACC6399F984FD07A949D6F3D28D2FA3.cache.js",
"deps/GeoGebra/HTML5/5.0/web3d/deferredjs/*",
"deps/GeoGebra/HTML5/5.0/css/bundles/bundle.css",
"deps/GeoGebra/HTML5/5.0/css/keyboard-styles.css",
"deps/GeoGebra/HTML5/5.0/css/fonts.css",
"deps/GeoGebra/HTML5/5.0/css/greek-font.css",
"deps/GeoGebra/HTML5/5.0/css/bundles/simple-bundle.css",
"deps/GeoGebra/HTML5/5.0/web3d/fonts/base/jlm_cmmi10.js"
]
}],
"permissions": ["storage"]

View file

@ -16,8 +16,10 @@
<br/>
<br/>
Alter execution of the translated applet: <br/>
<label for="showall">Show all entities, even hidden ones</label>
<input type="checkbox" id="showall">
<label for="showall">Show all applet entities, even hidden ones</label>
<input type="checkbox" id="showall"><br/>
<label for="showaux">Show geogebra auxiliaries (not in applet)</label>
<input type="checkbox" id="showaux">
<script src="options.js" type="module"></script>
</body>