Bản khảo sát nghiên cứu: Cho chúng tôi biết trải nghiệm của bạn khi sử dụng Blockly
Bắt đầu khảo sát
Các phần tử
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Trong quá trình đo lường, khối được chia thành các hàng chứa các phần tử không trùng lặp và các khoảng trống của phần tử.
Các phần tử
Phần tử biểu thị các đối tượng trực quan trên một khối. Ví dụ như các phần tử đại diện cho:
- Các trường
- Biểu tượng
- Kết nối
- Góc
Mỗi phần tử là một hình chữ nhật xác định các ranh giới của đối tượng trực quan, cộng với một số dữ liệu bổ sung dành riêng cho từng loại phần tử.
Các ranh giới của phần tử thường được xác định bởi một số lớp bên ngoài (tức là thứ mà các phần tử này đại diện). Ví dụ: các phần tử của trường đại diện cho các trường và kích thước của các phần tử đó được xác định bằng phương thức getSize
của trường đó.
Dấu cách phần tử
Dấu cách phần tử là một không gian trống giữa các phần tử trong một hàng.
Giới hạn của các khoảng trống được xác định bằng thông tin kết xuất trong quá trình đo lường. Sau khi đo lường tất cả các thành phần của khối, thông tin kết xuất sẽ chèn các khoảng trắng có kích thước đã chọn giữa các thành phần. Kích thước không nhất thiết phải nhất quán; chúng thường khác nhau tuỳ thuộc vào các phần tử ở một trong hai bên của dấu cách.
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-07-25 UTC.
[null,null,["Cập nhật lần gần đây nhất: 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."]]