add Iris Text extension - #623
Conversation
✅ Preview readyYour changes are live at: https://brave-yonder-d2e8daa0.skr.mubilop.com/ Built from |
|
Also I admit the schedule tag logic is very flimsy and tends to break. I don't understand a lot of the VM, lol. I did what I could |
|
Dont take this as a snarky comment, but if you know it tends to break, why should this be merged? People are just gonna report bugs when it does break. Btw:
|
|
Current implementation of reset transformations seems to make it so the flag won't apply tags on several runs of the same code |
well... honestly, i was gonna attempt to correct most / all the bugs in this PR and also thank you lol |
|
If thats the case, this should be a draft |
oh shit i lowkey forgot that was a feature LMAO |
all good |
|
Every issue listed here should (hopefully) be resolved. I've done testing on my end and it works |
|
I'll turn this back into a regular PR. If more bugs are found I'll make it a draft again. I've also replaced the "schedule" block with another one that works slightly differently, but is WAY friendlier for the user. |
|
found some stuff myself. i'll undraft soon |
|
the ext is now ready for review again :D i added a ton of things. i am aware it's not exactly the most optimized extension ever, but i did what i could. i will update with another PR after this one's merged if i can optimize it more |
SharkPool-SP
left a comment
There was a problem hiding this comment.
These are the only problems i can see rn
| ]; | ||
|
|
||
| const customFonts = []; | ||
| document.fonts.forEach(face => { |
There was a problem hiding this comment.
forEach wont work on browsers like Safari. I encountered this issue with display text,
Use Array.from() and iterate through that
| top.strike = true; | ||
| break; | ||
| case 'size': | ||
| top.size = Number(value) || top.size; |
There was a problem hiding this comment.
Scratch.Cast.toNumber() ?
| textSoFar += text.slice(i, match.index); | ||
| stages.push({ | ||
| text: textSoFar, | ||
| waitAfter: Math.max(0, Number(match[1]) || 0) |
There was a problem hiding this comment.
Scratch.Cast.toNumber() ?
| ctx.drawImage(shape.canvas, padPx, padPx); | ||
|
|
||
| entry = { | ||
| canvas, |
There was a problem hiding this comment.
It will be a smarter and more optimzied idea to use a centeralized canvas for these operations.
Browsers have a max canvas limit apparently.
This also goes for getMaskPatternSurface
| } | ||
|
|
||
| function drawMaskedGlyph(destCtx, char, fontFamily, size, weight, style, mask, texture, worldDrawX, worldDrawY, spanW, spanH, spanOriginX, spanOriginY, destX, destY, alpha) { | ||
| const coverage = Math.max(0, Math.min(100, Number(mask.coverage) || 0)) / 100; |
There was a problem hiding this comment.
Scratch.Cast.toNumber()
| applyExportSettings(args, util) { | ||
| let settings; | ||
| try { | ||
| settings = JSON.parse(Scratch.Cast.toString(args.SETTINGS)); |
There was a problem hiding this comment.
should confirm this is an object. Users can pass numbers, objects, arrays, etc. and this will be fine with it
|
|
||
| function flushPendingRenders() { | ||
| if (!pendingRenderTargets.size) return; | ||
| const renderTargets = new Set(pendingRenderTargets); |
There was a problem hiding this comment.
why are we making a set of a set?
| if (state.shapeKey !== shapeKey || state.layoutKey !== layoutKey || !layout || state.fontsPendingAtMeasure) { | ||
| const richChars = parseRichText(state.rawText, state.baseStyle); | ||
| applyCharacterStyleOverrides(richChars, state.charStyleOverrides); | ||
| const families = new Set(richChars.map(rc => rc.font)); |
There was a problem hiding this comment.
surely we can pre-make this set right?
| installLinearFiltering(current, state); | ||
| } | ||
| } | ||
| renderer.updateDrawableSkinId(target.drawableID, state.skinId); |
There was a problem hiding this comment.
do not run this if the skin already is set for the drawable. Unecessary work
| const stage = frame.irisStages[frame.irisStageIndex]; | ||
| state.rawText = stage.text; | ||
| state.paintDirty = true; | ||
| scheduleTextRender(util.target); |
There was a problem hiding this comment.
if the text is the same we are forcing the renderer to redraw the skin.





yeah. this one took me a while
this PR also simultaneously corrects my creator name so that it uses my github