You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
scribble_element.wrap(maxWidth, [maxHeight], [characterWrap], [lineShift]);
-----------------------
Example:
scribble("Hello world, how are you?").wrap(40, -1, false, 10);
Hello
world,
how are
you?
lineShift would shift by a specific amount every new wrapped line relatively to the previous one.
The feature could also be its own method to allow for even more customization without bloating the .wrap() method.
scribble_element.wrapShift(shift1, [shift2] ...);
-----------------------
Example:
scribble("Hello world, how are you?").wrapShift(40,-20);
Hello
World
how are
you?
Where the last argument would affect every line going down if no more arguments are provided
The text was updated successfully, but these errors were encountered:
Thought about this a little bit and I think I'll go for a .lineXOffsetFunc() text element method. This method would take a function as a parameter. Whenever a new line is created (either via \n, [/page], or text wrapping) then this function would be called.
The function is handed 4 arguments:
lineIndex: The index of the line on the page, with 0 being the first line of text on the page
indentX: The horizontal indentation relative to the first line of text on the page, measured in pixels. This currently would always be 0 but this may change in the future if/when the [indent] command tag is introduced
lineY: The vertical offset relative to the first line of text on the page, measured in pixels
breakType: From the SCRIBBLE_BREAK_TYPE enum, either .FIRST_LINE.LINEBREAK, .PAGEBREAK, or .WRAP
This function provided to .lineOffset() should then return a number indicating the x-offset for that particular new line of text. This allows for a lot of different kinds of behaviours without lots of perculiar arithmetic inside the parser itself.
The feature could work like this:
lineShift would shift by a specific amount every new wrapped line relatively to the previous one.
The feature could also be its own method to allow for even more customization without bloating the .wrap() method.
Where the last argument would affect every line going down if no more arguments are provided
The text was updated successfully, but these errors were encountered: