Elementy
Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
Podczas pomiaru blok jest rozbity na wiersze zawierające nienakładające się elementy i odstępy elementów.
Elementy
Elementy reprezentują obiekty wizualne na bryle. Oto przykłady:
- Pola
- Ikony
- Połączenia
- Narożniki
Każdy element jest prostokątem określającym granice elementu wizualnego oraz dodatkowe dane specyficzne dla każdego z nich.
Granice elementu są zwykle określane przez klasę zewnętrzną (czyli przedmiot, który reprezentuje). Na przykład elementy pól reprezentują pola, a ich rozmiar jest określany za pomocą metody getSize
pola.
Odstęp elementu
Odstęp elementu to pusta przestrzeń między elementami w rzędzie.
Granice odstępów są określane na podstawie informacji o renderowaniu podczas pomiaru. Po zmierzeniu wszystkich elementów bloku informacje o renderowaniu wstawiają między nimi odstępy o wybranym rozmiarze. Rozmiary nie muszą być spójne. Często różnią się w zależności od elementów po obu stronach odstępy.
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\u003eDuring the measurement phase, a block is deconstructed into rows comprising elements and element spacers for rendering purposes.\u003c/p\u003e\n"],["\u003cp\u003eElements represent the visual components of a block, including fields, icons, connections, and corners, with their size usually determined by the element they represent.\u003c/p\u003e\n"],["\u003cp\u003eElement spacers are empty spaces inserted between elements to control the spacing and visual layout of the block.\u003c/p\u003e\n"]]],["During the measurement phase, blocks are divided into rows with elements and spacers. Elements, such as fields, icons, connections, and corners, are represented by rectangles with specific data. Their sizes are dictated by external classes, like a field's `getSize` method. Element spacers are empty spaces inserted between elements by the render info, with varying sizes based on the adjacent elements. The render info determines spacer sizes after measuring all block elements.\n"],null,["# Elements\n\nDuring [measurement](/blockly/guides/create-custom-blocks/renderers/concepts/info) the block gets broken up into [rows](/blockly/guides/create-custom-blocks/renderers/concepts/rows)\ncontaining non-overlapping elements and element spacers.\n\nElements\n--------\n\nElements represent visual things on a block. Examples include elements\nrepresenting:\n\n- Fields\n- Icons\n- Connections\n- Corners\n\nEach element is a rectangle defining the bounds of the visual thing, plus some\nextra data specific to each kind of element.\n\nThe bounds of the element are usually determined by some external class\n(that is, the thing they represent). For example,\n[field elements](/blockly/reference/js/blockly.blockrendering_namespace.field_class) represent fields, and their size is determined\nby the field's [`getSize`](/blockly/reference/js/blockly.field_class.getsize_1_method) method.\n\nElement spacer\n--------------\n\nAn element spacer is an empty space that goes between elements in a row.\n\nThe bounds of spacers are determined by the [render info](/blockly/guides/create-custom-blocks/renderers/concepts/info) during\nmeasurement. After measuring all of the elements of the block, the\n[render info](/blockly/guides/create-custom-blocks/renderers/concepts/info) inserts spaces of its chosen size between\nthe elements. The sizes don't have to be consistent; they are often different\ndepending on the elements to either side of the spacer."]]