Project here.
Currently it's mostly about making and returning them. I imported the script builder library by @pumpkinhead, @joecooldoo's "report block" block, (with a little edit making "template" blocks easier) and I got the JS for the "comment" block from @helicoptur and blocks.js
.
Nice. I'd suggest adding that reports a comment in headline-only mode.
I'm not sure how to do that. I'd have to look at where the properties of CommentMorph
are defined. Do you know what file that's in?
Edit: It's in blocks.js
.
Edit 2: I just found out that the paragraph introducing CommentMorph
is written from the point of view of CommentMorph
itself:
/*
I am an editable, multi-line non-scrolling text window. I can be collapsed
to a single abbreviated line or expanded to full. My width can be adjusted
by the user, by height is determined by the size of my text body. I can be
either placed in a scripting area or "stuck" to a block.
*/
Not exactly what you wanted, but I updated it with this:
(And yes, I did put a silly 500 in to show that the width thing works.)
I added (collapse/expand comment ).
Can't you make one, measure the actual text width, and set the comment width to that much?
(By the way, I think it's a Snap! misfeature that if there's an actual newline ending the first line of the comment, collapsing it still uses all the text; it should just use the first line in that case. Imho.)
I'm not exactly sure what you mean. Do you mean a "smart" width comment?
Yeah. I might make that.
I'm not sure what you mean by that! :~) Yeah, I mean measure the actual width of the comment (by WRITEing it and checking your X POSITION).
uses a different font from comments.
Oh ugh. But I think there's another thread about an extended WRITE that lets you specify the font!
Yeah; one I was actually on, as well as you, iirc.
Well there you go then!
ctx.measureText(text);
How do I get a CanvasRenderingContext2D inside Snap!?
Thanks! It works! And I made
kind of. It still uses all the text, but it gets set to just the right width so that only the first line can be seen:
Cool! What a hack.
(three months later)
I made the RINGIFY block actually work. Try it:
Same for literally every other morph. I think this is another quirk inherited from Squeak, which morphic.js (maybe Snap!'s coding style too) is clearly inspired by.
Yep!
IDK. You'd have to ask Jens.