Stay organized with collections
Save and categorize content based on your preferences.
blockly > utils > svgPaths > lineOnAxis
utils.svgPaths.lineOnAxis() function
Draw a horizontal or vertical line. The first argument specifies the direction and whether the given position is relative or absolute. These coordinates are unitless and hence in the user coordinate system. See developer.mozilla.org/en-US/docs/Web/SVG/Attribute/d#LineTo_path_commands
Signature:
export declare function lineOnAxis(command: string, val: number): string;
Parameters
Parameter |
Type |
Description |
command |
string |
The command to prepend to the coordinate. This should be one of: V, v, H, h. |
val |
number |
The coordinate to pass to the command. It may be absolute or relative. |
Returns:
string
A string of the format ' command val '
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-09-18 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-09-18 UTC."],[[["The `utils.svgPaths.lineOnAxis()` function generates SVG path commands for drawing horizontal (H, h) or vertical (V, v) lines."],["It takes a command string (V, v, H, h) specifying the line's direction and coordinate type (absolute or relative), and a numeric value representing the line's position in user coordinates."],["The function returns a formatted string that can be used within an SVG path's `d` attribute to render the line."],["These coordinates are unitless and are in the user coordinate system, for further information refer to the documentation on SVG Path LineTo commands: [developer.mozilla.org/en-US/docs/Web/SVG/Attribute/d#LineTo_path_commands](developer.mozilla.org/en-US/docs/Web/SVG/Attribute/d#LineTo_path_commands)."]]],[]]