laurent.orseau
2021-1-21 09:17:55

@alexharsanyi has possibly already dealt with this?


alexharsanyi
2021-1-21 10:44:43

I did not use embedded editors, and without seeing an example, it is difficult to know what is going on. But the first thing I would check is that the snips are positioned such that they are in the visible portion of the embedded editor — I think the draw method will not be invoked if the snip is completely outside the visible area


zk19980223
2021-1-21 14:45:59

@zk19980223 has joined the channel


bmitchell33
2021-1-21 15:28:10

Yep, I’m definitely heavily using Alex’s blog posts and codebase but didn’t see a use of editor-snip%

Thanks for the heads up Alex. My assumption was that the coordinates of the snip insert are relative to the embedded editor rather than the top-level pasteboard. Maybe that’s incorrect. (I sure hope not!) I’ll try and post some code if no one is aware if this is something that should just work.


bmitchell33
2021-1-21 15:29:33

Also, Alex, the ghosting issue of the selection handles is back, and I think it’s related to our discussion. Since it seems the pasteboard doesn’t handle setting the smoothing correctly, I see ghosting again with the embedded editor.


bmitchell33
2021-1-21 18:48:14

Here’s some code that tries to display a snip in an editor snip.


anything
2021-1-21 20:48:29

Did you by any chance add any form of access to a Keccak-f permutation? (<http://www.lysator.liu.se/~nisse/nettle/nettle.html|Section 7.1.1.5 in nettle’s documentation> mentions Keccak 256, but it’s unclear whether it implements it or not.) Either way, thanks for the library!


maueroats
2021-1-21 22:14:12

Question: Is there a reason that "transparent" is only a color added in 2htdp/image and not in the-color-database? This causes “transparent” not to be a legal color in Typed Racket via the https://github.com/lexi-lambda/racket-2htdp-typed\|2htdp-typed package. Would there be any willingness to add an official color “transparent”?


ryanc
2021-1-21 23:29:08

I’m not sure exactly what you’re asking. I haven’t added access to any operation lower-level than the digest itself (eg, no Keccak-f permutation function, no Salsa double-round function, etc). Just in case you’re confused about the name: SHA3 = KECCAK (in the same way that AES = Rijndael) — except that NIST changed some of the constants (which threw a shadow of distrust over the whole algorithm). Based on a quick google, I think no one uses the original constants except for Ethereum, and so they (eventually) started calling it KECCAK–256 to distinguish it from SHA3–256. IIUC, nettle introduced SHA3 support before NIST released the final standard that changed the constants, so a few old versions of nettle used the original constants. You’re welcome!


alexharsanyi
2021-1-21 23:59:37

Your nodal-editor-snip% overrides the draw method of the editor-snip%, but that method is used to draw the member snips of the editor. This means that the editor snip’s draw method is never invoked and therefore the member snips are not drawn.

You can easily verify this by commenting out the draw method of nodal-editor-snip% and you’ll see that the snips are now drawn.

To fix this you also need to call the parents draw method (e.g. (super draw dc ...) )


bmitchell33
2021-1-22 00:21:07

Oh, there’s my mistake. Thank you for taking a look.

My assumption was, since editor-snip% inherits from snip% , that it would behave like a snip with the draw method. I just wasn’t thinking along these lines.


bmitchell33
2021-1-22 00:22:35

I guess the owning pasteboard will call the embedded editor’s draw method like a snip, but then the embedded editor will still handle its snips like a regular pasteboard.


samth
2021-1-22 01:46:19

My guess is that the use of “transparent” in 2htdp/image is a shortcut to make it easier for students


samth
2021-1-22 01:46:36

And that the right thing to do is fix 2htdp-type


bmitchell33
2021-1-22 03:04:15

Things are pretty confusing though, although I am probably missing something else. The display is unexpected (I was expecting the snip display to be identical to using a snip on a pasteboard on an editor-canvas_, so I’m not sure where the extra borders and margins are coming from at this point. More experimenting and reading to do!


maueroats
2021-1-22 04:52:46

The fix makes sense, but does involve adding a special case. Would there be any downsides to having an official “transparent” color, probably (0,0,0,0) ? I guess yes because none of the machinery is set to work with the alpha channel. Fair enough.


maueroats
2021-1-22 04:58:13

Although I guess it could just be pushed into the-color-database with one extra line of code, so that argument isn’t worth much.