แบบสำรวจการวิจัย: บอกให้เราทราบเกี่ยวกับประสบการณ์การใช้งาน Blockly
เริ่มแบบสำรวจ
แนวคิดโปรแกรมแสดงภาพ
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
ก่อนที่จะเริ่มสร้างตัวแสดงผลที่กำหนดเอง คุณควรทำความเข้าใจคอมโพเนนต์ต่างๆ ที่ประกอบกันเป็นโหมดแสดงภาพ ตลอดจนวิธีที่บล็อกแบ่งออกเป็นแถวและองค์ประกอบ
คอมโพเนนต์ของโปรแกรมแสดงภาพ
โหมดแสดงภาพสร้างขึ้นจากคอมโพเนนต์ต่างๆ มากมาย คอมโพเนนต์แต่ละอย่างมีหน้าที่
ไม่ซ้ำกันในการขยายและการใช้โค้ดซ้ำให้ได้สูงสุด
โหมดแสดงภาพ
ผู้แสดงผลเป็นคลาสจากโรงงานที่รวมคอมโพเนนต์อื่นๆ ทั้งหมดเข้าด้วยกัน
ผู้ให้บริการแบบคงที่
ผู้ให้บริการค่าคงที่คือกลุ่มของตัวเลขและรูปร่างที่คอมโพเนนต์อื่นๆ ทั้งหมดใช้ รวมถึงช่องในตัว
แสดงผลข้อมูล
ข้อมูลการแสดงผลจะตัดสินใจเลือกวิธีจัดวางบล็อกตามคำจำกัดความ จากนั้นจะสร้างคอลเล็กชันที่วัดได้และข้อมูลเกี่ยวกับการบล็อกที่ลิ้นชักใช้ในการสร้างเส้นทาง SVG
ออบเจ็กต์เส้นทาง
ออบเจ็กต์เส้นทางมีองค์ประกอบ SVG ที่อาศัยอยู่ในโดเมน
และประกอบเป็นบล็อก
ลิ้นชัก
ลิ้นชัก (ดังเช่น "ผู้วาดคนเดียว") จะสร้างเส้นทาง SVG ตามข้อมูลการแสดงผล และนำไปใช้กับออบเจ็กต์เส้นทาง
บล็อกการวัดผล
เมตริกที่วัดได้คือสี่เหลี่ยมผืนผ้าซึ่งแสดงพื้นที่ของบล็อก การวัดผลคือสิ่งที่ข้อมูลการแสดงผลใช้เพื่อกำหนดเลย์เอาต์ของการบล็อก
การวัดผลบางประเภทยังรวมข้อมูลเพิ่มเติม (เช่น ภาพที่นำเสนอ) หรือวิธีการช่วยเหลือที่ข้อมูลการแสดงผลสามารถใช้เพื่อหาวิธีจัดวางองค์ประกอบได้ด้วย
โหมดแสดงภาพที่แตกต่างกันอาจสร้างการวัดที่กำหนดเองเพื่อเปลี่ยนแปลงข้อมูลหรือเมธอดของตัวช่วยเหล่านี้
แถว
แถวคือคอลเล็กชันแนวนอนขององค์ประกอบและที่กั้นองค์ประกอบ
ที่กั้นระยะแถว
ที่กั้นแถวคือพื้นที่แนวตั้งที่ว่างเปล่าซึ่งอยู่ระหว่าง 2 แถว
องค์ประกอบ
องค์ประกอบ หมายถึงสิ่งที่มองเห็นในบล็อก ซึ่งได้แก่ ช่อง ไอคอน การเชื่อมต่อ ฯลฯ
ที่กั้นองค์ประกอบ
ที่กั้นระยะองค์ประกอบคือพื้นที่ว่างที่เชื่อมระหว่างองค์ประกอบในแถว
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-25 UTC
[null,null,["อัปเดตล่าสุด 2025-07-25 UTC"],[[["\u003cp\u003eBlockly renderers are comprised of several components (Renderer, Constant Provider, Render Info, Path Object, and Drawer) working together to display blocks.\u003c/p\u003e\n"],["\u003cp\u003eRenderers utilize "measurables" to define the layout of a block, which are rectangular regions representing different parts of the block.\u003c/p\u003e\n"],["\u003cp\u003eBlocks are visually structured using rows and elements, with spacers providing spacing between them for better organization.\u003c/p\u003e\n"],["\u003cp\u003eEach component of a renderer has a specific role, such as defining constants, laying out the block, creating SVG paths, and managing the SVG elements.\u003c/p\u003e\n"],["\u003cp\u003eCustom renderers can be built by extending or modifying these components and measurables for unique visual styles and behaviors.\u003c/p\u003e\n"]]],["A renderer is composed of several components: the **renderer** (factory class), **constant provider** (numbers/shapes), **render info** (layout decision-maker), **path object** (SVG elements), and **drawer** (SVG path builder). **Render info** uses **measurables** (block region rectangles) to define the block's layout. Blocks are structured into horizontal **rows** of **elements** (visual components) separated by **element spacers**, and rows are separated by **row spacers**.\n"],null,["# Renderer concepts\n\nBefore you start building a custom renderer, it is helpful to understand the\ndifferent components that make up a renderer, as well as how a block gets\nbroken up into rows and elements.\n\nRenderer components\n-------------------\n\nA renderer is built up of several different components. Each component has a\nunique job to maximize code reuse and extensibility.\n\n### Renderer\n\nThe [renderer](/blockly/guides/create-custom-blocks/renderers/concepts/renderer) is a factory class that bundles all of the other\ncomponents together.\n\n### Constant provider\n\nThe [constant provider](/blockly/guides/create-custom-blocks/renderers/concepts/constants) is a collection of numbers, and shapes used\nby all of the other components, as well as built-in fields.\n\n### Render info\n\nThe [render info](/blockly/guides/create-custom-blocks/renderers/concepts/info) decides how it a block should be laid out based\non its definition, and then creates a collection of\n[measurables](#block_measurables) and data about the block which the\n[drawer](/blockly/guides/create-custom-blocks/renderers/concepts/drawer) uses to create SVG paths.\n\n### Path Object\n\nThe [path object](/blockly/guides/create-custom-blocks/renderers/concepts/path-object) contains the SVG elements that live in the dom\nand make up the block.\n\n### Drawer\n\nThe [drawer](/blockly/guides/create-custom-blocks/renderers/concepts/drawer) (as in \"one-who-draws\") builds SVG [paths](https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths) based on\nthe [render info](/blockly/guides/create-custom-blocks/renderers/concepts/info) and applies them to the\n[path object](/blockly/guides/create-custom-blocks/renderers/concepts/path-object).\n\nBlock measurables\n-----------------\n\nA measurable is a rectangle representing a region of a block. Measurables are\nwhat the [render info](/blockly/guides/create-custom-blocks/renderers/concepts/info) uses to define the layout of the block.\n\nSome measurables also include extra data (such as the visual thing they are\nrepresenting), or helper methods that the render info can use to figure out how\nto lay out the block.\n\nDifferent renderers may create custom measurables to change these data or\nhelper methods.\n\n### Rows\n\nA [row](/blockly/guides/create-custom-blocks/renderers/concepts/rows) is a horizontal collection of [elements](/blockly/guides/create-custom-blocks/renderers/concepts/elements) and\n[element spacers](/blockly/guides/create-custom-blocks/renderers/concepts/elements#element_spacer).\n\n### Row spacers\n\nA [row spacer](/blockly/guides/create-custom-blocks/renderers/concepts/rows#row_spacer) is an empty vertical space that goes between two\nrows.\n\n### Elements\n\nAn [element](/blockly/guides/create-custom-blocks/renderers/concepts/elements) represents a visual thing on a block. These include\n[fields](/blockly/guides/create-custom-blocks/fields/overview), [icons](/blockly/guides/create-custom-blocks/icons/overview), connections, etc.\n\n### Element spacers\n\nAn [element spacer](/blockly/guides/create-custom-blocks/renderers/concepts/elements#element_spacer) is an empty space that goes between elements\nin a row."]]