Stay organized with collections
Save and categorize content based on your preferences.
blockly > blockRendering > Drawer > draw
blockRendering.Drawer.draw() method
Draw the block to the workspace. Here "drawing" means setting SVG path elements and moving fields, icons, and connections on the screen.
The pieces of the paths are pushed into arrays of "steps", which are then joined with spaces and set directly on the block. This guarantees that the steps are separated by spaces for improved readability, but isn't required.
Signature:
draw(): void;
Returns:
void
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 `blockRendering.Drawer.draw()` method visually renders a block on the workspace by manipulating SVG elements for its shape, fields, icons, and connections."],["This method achieves the visual representation by constructing SVG paths, dividing them into \"steps,\" and applying them directly to the block element for clear and readable rendering."],["The process focuses on updating the visual aspects of the block on the workspace without returning any specific value."]]],["The `draw()` method, part of the `blockRendering.Drawer` class, is responsible for rendering a block onto the workspace. This involves setting SVG path elements and positioning fields, icons, and connections. The method constructs the block's path by pushing path segments into \"steps\" arrays. These steps are then joined with spaces and assigned directly to the block. The method does not take any arguments and does not return anything.\n"]]