Survei Riset: Ceritakan pengalaman Anda dengan Blockly
Mulai survei
blockly > blockRendering > RenderInfo > getElemCenterline_
Metode blockRendering.RenderInfo.getElemCenterline_()
Menghitung garis tengah elemen pada baris yang dirender. Implementasi dasar ini menempatkan garis tengah di tengah baris secara vertikal, tanpa kasus khusus. Anda mungkin memerlukan logika tambahan untuk menangani (minimal) baris atas dan bawah.
Tanda Tangan:
protected getElemCenterline_(row: Row, elem: Measurable): number;
Parameter
Parameter |
Jenis |
Deskripsi |
baris |
Baris |
Baris berisi elemen. |
Elem |
Terukur |
Elemen yang akan ditempatkan. |
Hasil:
angka
Garis tengah yang diinginkan dari elemen yang diberikan, sebagai offset dari kiri atas blok.
Kecuali dinyatakan lain, konten di halaman ini dilisensikan berdasarkan Lisensi Creative Commons Attribution 4.0, sedangkan contoh kode dilisensikan berdasarkan Lisensi Apache 2.0. Untuk mengetahui informasi selengkapnya, lihat Kebijakan Situs Google Developers. Java adalah merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2024-08-21 UTC.
[null,null,["Terakhir diperbarui pada 2024-08-21 UTC."],[[["The `getElemCenterline_` method calculates the vertical center of an element within a rendered row of a block."],["It positions elements in the middle of the row by default, but additional logic may be needed for top and bottom rows."],["This method is primarily used within the block rendering process to determine element placement."],["It takes the row and the element as input and returns the vertical offset from the block's top left corner."]]],["The `getElemCenterline_()` method calculates the vertical centerline of an element within a rendered row. It positions the centerline at the row's vertical midpoint. The method takes a `Row` and a `Measurable` element as input. It returns a number representing the element's centerline offset from the block's top-left corner. Custom implementations are often needed to adjust positioning for specific rows.\n"]]