|
From: Mark P. <pe...@so...> - 2025-06-03 00:28:50
|
Hi Jochen,
I forgot to say, I set height and width as pixel values instead of
percentages before I initialized it. I didn't know JSmol accepted
percentages.
Thanks,
Mark
On Mon, Jun 2, 2025 at 3:52 AM Jochen Junker <joc...@fi...>
wrote:
>
> Hi Mark!
>
> It is about jmolc, yes.
>
> It is initialized at line 1722 in function InitAfter():
> Jmol.setDocument(0);
> Jmol.getApplet("jmolc", InfoC);
> t = Jmol.getAppletHtml(jmolc);
> d = document.getElementById("jsmol_container");
> setInnerHTML(d,t);
>
> The block is initially set to display none, it is set to display as block
> later. This 3D viewer will not always be shown.
>
> This is exactly the same code as for v14, where it works.
>
> Jochen
>
>
> On 2 Jun 2025, at 00:02, Mark Perri <pe...@so...> wrote:
>
> Hi Jochen,
>
> Are you talking about jmolc? I can't find where it's created in your
> source. But it's not getting loaded correctly: jmolc._applet is null.
>
> If you do:
> document.getElementById("jsmol_container").innerHTML="";
>
> document.getElementById("jsmol_container").innerHTML=Jmol.getAppletHtml("jmolc",Info);
>
> It will load.
>
> The css is also display:none, but I'm not sure if that's because it's not
> loaded correctly.
>
> Thanks,
> Mark
>
> On Sun, Jun 1, 2025 at 11:58 AM Jochen Junker <joc...@fi...>
> wrote:
>
>>
>> Hi Bob!
>>
>> Thank you and Angel for your input. I have had my share of cache related
>> issues, so I can rule that out.
>>
>> 0. Try a different browser. Sometimes one is ahead of another in
>> JavaScript, and there is some change there.
>>
>>
>> I normally do my development on Firefox because of the Debugger. The same
>> error happens on Safari and Chrome. On Chrome I got the most meaningful
>> error message: “IndexSizeError: Failed to execute 'getImageData' on
>> 'CanvasRenderingContext2D': The source width is 0."
>>
>> But, I do not get any errors on the console. On the console I see the
>> normal messages that the applet was started.
>>
>> 1. Use URL option ?j2sdebugcode
>>
>>
>> ? can be & or # as needed if you already have query fields in the URL.
>>
>>
>> Unfortunately this does not work in this case.
>>
>> 2. Open the browser developer console debugger or source tab and click
>> stop on errors, including caught errors
>>
>> The page always throws and catches a few errors as it loads in order to
>> check the browser for comparability issues. So push through those until the
>> error you are seeing is thrown.
>>
>> There is also at least one error that does not generally affect loading
>> that should not be there but I have not worried about it. Maybe you can
>> tell me how to get around that.
>>
>>
>> In V14 I get the CORS error, but that is it.
>> In V16 I get no significant errors from Jmol.
>>
>> IndexSizeError: Index or size is negative or greater than the allowed
>> amount
>>
>> This error is interesting because I think it is new. I have not seen it
>> before, at least stated as such. Traditionally JavaScript does not throw
>> array out of bounds exceptions except for negative numbers. Probably a
>> counter went negative.
>>
>>
>> This error seems to be related to using clipping in canvas’ drawImage
>> function:
>>
>> https://stackoverflow.com/questions/19338032/canvas-indexsizeerror-index-or-size-is-negative-or-greater-than-the-allowed-a
>>
>> 3. Another option is to use the _J2S option. The value of that should be
>> the full path to a j2s directory on another path or domain. This allows
>> direct comparison between two versions on the same or different machines.
>>
>> 4. At this point if I am still not seeing the exact problem I start
>> setting debugging break points, reloading the page to see what is going on
>> at some particular point. This invariably at least identifies the problem.
>>
>> 5. Worst case process is to run two versions side by side with break
>> points in the same place looking for differences. This ultimately discovers
>> the issue. It's a huge help to have one working version. This is a famous
>> truck and one that I use regularly on the Java side. I always start with
>> the SwingJS code and then power that to the legacy only when it is working
>> in SwingJS.
>>
>> 6. Be patient and confident that whatever the problem is, it is most
>> likely something very simple.
>>
>> 7. Send us a link to the failing page. Several people reading this can
>> give it a try. Only do the above if you are interested in the challenge.
>>
>>
>> As suggested, I have set up 2 pages just differing in the Jmol version.
>> Version 14 here: https://toratheu.de/compare14?cocon1720457998896
>> <https://ddec1-0-en-ctp.trendmicro.com/wis/clicktime/v1/query?url=https%3a%2f%2ftoratheu.de%2fcompare14%3fcocon1720457998896&umid=e537e692-ac4a-4dd0-bf50-88055a9654fd&rct=1748833820&auth=1bcda6227c1853a98db9a85322c3ec3db27ad845-d5e736e3d28bd18eeddde7ca638bc20c5a453f8c>
>> Version 16 here: https://toratheu.de/compare16?cocon1720457998896
>> <https://ddec1-0-en-ctp.trendmicro.com/wis/clicktime/v1/query?url=https%3a%2f%2ftoratheu.de%2fcompare16%3fcocon1720457998896&umid=e537e692-ac4a-4dd0-bf50-88055a9654fd&rct=1748833820&auth=1bcda6227c1853a98db9a85322c3ec3db27ad845-3b80a51ffb6967446e8ad29ff7eb355ba2c951f9>
>>
>> This pages are on a development server. Opening the pages will give 2 XHR
>> 404 errors, which are handled gracefully and do not relate to Jmol. Besides
>> that the Debugger in Firefox does not give out any errors. To see the other
>> instances of Jmol working on the Version 16 page you have to click the
>> 3D/2D toggle in the results window (Title: Total of 28 Constitutions
>> found). I have embedded the Jmol loading messages in an other window, makes
>> it easier to follow.
>>
>> I have also managed to identify where the error happens, a screenshot of
>> the location follows. Maybe that helps.
>>
>> Best Regards,
>> Jochen
>>
>>
>> <Screenshot 2025-06-01 at 15.54.10.png>
>> _______________________________________________
>> Jmol-users mailing list
>> Jmo...@li...
>> https://lists.sourceforge.net/lists/listinfo/jmol-users
>>
> _______________________________________________
> Jmol-users mailing list
> Jmo...@li...
> https://lists.sourceforge.net/lists/listinfo/jmol-users
>
>
> _______________________________________________
> Jmol-users mailing list
> Jmo...@li...
> https://lists.sourceforge.net/lists/listinfo/jmol-users
>
|