Obiekt ścieżki
Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
PathObject
zawiera elementy SVG w DOM, które tworzą blok.
Na przykład w edytorze Geras są to ścieżki „główne”, „ciemne” i „jasne”, które nadają efekt 3D. Obiekt ścieżki tworzy elementy SVG dla każdej z nich.

W przeciwieństwie do mechanizmu renderowania Thrasos, którego bloki mają pojedynczy element ścieżki:

Obsługuje również:
- Stosowanie kształtu wygenerowanego przez szufladę do elementów SVG.
- stosowanie kolorów motywu do elementów SVG;
- Stosowanie innych stylów do elementów SVG.
O ile nie stwierdzono inaczej, treść tej strony jest objęta licencją Creative Commons – uznanie autorstwa 4.0, a fragmenty kodu są dostępne na licencji Apache 2.0. Szczegółowe informacje na ten temat zawierają zasady dotyczące witryny Google Developers. Java jest zastrzeżonym znakiem towarowym firmy Oracle i jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2025-07-25 UTC.
[null,null,["Ostatnia aktualizacja: 2025-07-25 UTC."],[[["\u003cp\u003eThe \u003ccode\u003ePathObject\u003c/code\u003e manages the SVG elements that visually represent a block in Blockly, such as the main, dark, and light paths for 3D effects.\u003c/p\u003e\n"],["\u003cp\u003eIt applies the shape created by the drawer, along with theme colors and other styling, to these SVG elements.\u003c/p\u003e\n"],["\u003cp\u003eDifferent renderers, like Geras and Thrasos, utilize \u003ccode\u003ePathObject\u003c/code\u003e to create unique visual styles for their blocks.\u003c/p\u003e\n"]]],["The `PathObject` class manages the SVG elements that form a block's visual representation within the DOM. It generates SVG elements for different paths (e.g., main, dark, light) as seen in the Geras renderer or a single path as in the Thrasos renderer. It also applies the shape from the drawer, incorporates theme colors, and applies other styling to these SVG elements. It handles all these visual modifications of the block.\n"],null,["# Path object\n\nThe [`PathObject`](/blockly/reference/js/blockly.blockrendering_namespace.pathobject_class) contains the SVG elements in the DOM\nthat make up the block.\n\nFor example, in the [Geras](/blockly/guides/create-custom-blocks/renderers/overview#built-in-renderers) renderer, blocks have a \"main\"\npath, a \"dark\" path and a \"light\" path, to give them a 3d effect. The\npath object creates the SVG elements for each of these paths.\n\nThis is opposed to the [Thrasos](/blockly/guides/create-custom-blocks/renderers/overview#built-in-renderers) renderer, whose blocks\nhave a single path element with a stroke:\n\nIt also handles:\n\n- Applying the shape generated by the [drawer](/blockly/guides/create-custom-blocks/renderers/concepts/drawer) to the SVG elements.\n- Applying [theme colors](/blockly/guides/configure/web/appearance/themes#block_style) to the SVG elements.\n- Applying other styling to the SVG elements."]]