Method for determining text width of a graphical programming platform for science and technology education
By initializing the selection range, segmenting and measuring the position information of multiple lines of text in the graphical programming platform, the problem of inaccurate text width and position control in the platform is solved, and high-precision text layout and display rendering are achieved.
Patent Information
- Application Number
- CN202411628173.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-14
- Publication Date
- 2025-04-08
AI Technical Summary
The prior art is difficult to accurately control the width and position of multi-line text in graphical programming platforms, especially in scenarios where high precision is required.
By initializing the selection range, reading the user input text and dividing it into multiple lines of text, determining the position information of each line of text, positioning the last line and measuring its width, and combining the width of other lines, calculating the total width of the user input text.
It realizes the precise width adaptation and display rendering of the text area of the graphical programming platform, improves the user experience and adapts to the display effect of different devices and browsers.
Smart Images

Figure CN119781754A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of science and technology education, and in particular to a method and device for determining text width of a graphical programming platform for science and technology education. Background Art
[0002] In modern web development, text layout processing is a very common and critical requirement, especially in responsive design scenarios. In order to ensure that web pages have a good user experience on different devices and screen sizes, developers usually need to dynamically adjust the position and width of the text. For example, when aligning text boxes, handling text overflow, and adapting to different device screen sizes, accurately determining and controlling the position and width of text is a key step in achieving complex layouts. Although the existing technology can handle the width and position of a single line of text in a simple way, it is often difficult to accurately control the specific position of the text in the layout processing of multiple lines of text, especially in scenarios that require higher precision such as graphical programming platforms. This limitation becomes more obvious.
[0003] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention
[0004] The embodiment of the present invention provides a method for determining text width of a graphical programming platform for science and technology education, so as to at least solve the technical problem of inaccurate control of text position in the graphical programming platform.
[0005] According to one aspect of an embodiment of the present invention, a method for determining text width of a graphical programming platform for science and technology education is provided, comprising: initializing a selection range and setting the selection range on a target text node; reading user input text in the selection range, dividing the user input text into multiple lines of text, and determining position information of the multiple lines of text, wherein the position information includes a starting position, an ending position, and a width of each line of text; locating the last line of the multiple lines of text based on the position information of the multiple lines of text, and measuring the width of the last line by obtaining rectangular information of the selection of the last line; and determining the total width of the user input text based on the width of the last line and the width of each line of text except the last line.
[0006] According to another aspect of an embodiment of the present invention, a rendering method of a graphical programming platform for science and technology education is provided, comprising: rendering a text area of the graphical programming platform based on the total width determined by the width determination method.
[0007] According to another aspect of an embodiment of the present invention, there is provided a text width determination device for a graphical programming platform for science and technology education, comprising: an initialization module, configured to initialize a selection range and set the selection range on a target text node; a position determination module, configured to read user input text in the selection range, divide the user input text into multiple lines of text, and determine position information of the multiple lines of text, wherein the position information includes a starting position, an end position, and a width of each line of text; a width measurement module, configured to locate the last line of the multiple lines of text based on the position information of the multiple lines of text, and measure the width of the last line by obtaining rectangular information of the selection of the last line; and a total width calculation module, configured to determine the total width of the user input text based on the width of the last line and the width of each line of text except the last line.
[0008] In an embodiment of the present invention, a selection range is initialized and the selection range is set on a target text node; user input text in the selection range is read, the user input text is divided into multiple lines of text, and the position information of the multiple lines of text is determined, wherein the position information includes the starting position, the ending position, and the width of each line of text; based on the position information of the multiple lines of text, the last line of the multiple lines of text is located, and the width of the last line is measured by obtaining the rectangular information of the selection range of the last line; based on the width of the last line and the width of each line of text other than the last line, the total width of the user input text is determined. Through the above scheme, the technical problem of inaccurate control of text position in a graphical programming platform is solved. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0010] Figure 1 is a flow chart of a method for determining text width of a graphical programming platform for science and technology education according to an embodiment of the present invention;
[0011] Figure 2 is a flow chart of another method for determining text width of a graphical programming platform for science and technology education according to an embodiment of the present invention;
[0012] Figure 3 is a flowchart of another method for determining text width of a graphical programming platform for science and technology education according to an embodiment of the present invention;
[0013] Figure 4is a flowchart of a method for initializing a selection range and setting it on a target text node according to an embodiment of the present invention;
[0014] Figure 5 is a flowchart of a method for obtaining the width of the last line of text according to an embodiment of the present invention;
[0015] Figure 6 is a flow chart of a rendering method of a graphical programming platform for science and technology education according to an embodiment of the present invention;
[0016] Figure 7 It is a structural schematic diagram of a text width determination device of a graphical programming platform for science and technology education according to an embodiment of the present invention;
[0017] Figure 8 A schematic diagram of the structure of an electronic device suitable for implementing the embodiments of the present disclosure is shown. DETAILED DESCRIPTION
[0018] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0019] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0020] According to an embodiment of the present invention, a method embodiment of a method for determining text width of a graphical programming platform for science and technology education is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0021] Existing graphical programming platforms use a pure CSS method when rendering text areas. This method lacks dynamism and relies on fixed width and alignment settings. It is difficult to adapt to dynamically generated or uncertain length text, which can easily lead to text overflow or layout disorder. In addition, different browsers handle font rendering in different ways, resulting in different display effects for the same settings, especially in font size, character spacing, and line height. In responsive design, CSS needs to set multiple media queries for different screen sizes, which increases the complexity of development and maintenance. In complex layout scenarios, CSS cannot accurately control the width and position of multiple lines of text. At the same time, JavaScript's text measurement relies on DOM operations. Frequent DOM operations will cause page reflow and redrawing, affecting performance and user experience, especially on low-performance devices or older browsers, which may cause compatibility issues.
[0022] In order to accurately locate the width position of multiple lines of text, this application combines the dynamic calculation capabilities of JavaScript and CSS. By measuring the actual width of the text through JavaScript and combining it with CSS styles, precise control of the text position can be achieved. This method can adapt to changes in text content and ensure consistent layout effects on different browsers and devices.
[0023] Figure 1 is a text width determination method of a graphical programming platform for science and technology education according to an embodiment of the present invention, such as Figure 1 As shown, the method comprises the following steps:
[0024] Step S102, initializing a selection range, and setting the selection range on a target text node.
[0025] On the target text node, a range object is created, wherein the range object represents a continuous area or range of the graphical programming platform; the start position and the end position of the range object are set to initialize the selection range, wherein the start position and the end position of the range object are used to mark the range of the user input text.
[0026] Step S104, reading the user input text in the selected area, dividing the user input text into multiple lines of text, and determining the position information of the multiple lines of text, wherein the position information includes the starting position, ending position, and width of each line of text.
[0027] The start position and the end position of the range object are gradually adjusted, the line break point of the user input text is detected, each line of text is identified and segmented; based on each line of text after segmentation, the position information of the multiple lines of text is determined. For example, the user input text is traversed in a recursive manner to identify the line break point and offset of each line of text; based on the line break point and the offset, each line of text is identified and segmented.
[0028] Step S106: locate the last line of the multiple lines of text based on the position information of the multiple lines of text, and measure the width of the last line by obtaining the rectangular information of the selected area of the last line.
[0029] Based on the position information of the multiple lines of text, the text range of the last line is found using the range object; and the width of the last line is measured by obtaining the rectangular information of the selected area of the text range of the last line.
[0030] Step S108: determining the total width of the user input text based on the width of the last line and the width of each line of text except the last line.
[0031] Figure 2 It is another method for determining the text width of a graphical programming platform for science and technology education according to an embodiment of the present invention. This method accurately measures the width of multiple lines of text, especially the width of the last line, by creating and using a range object. First, the range object is set on the target text node, its starting and ending positions are gradually adjusted, the line break points of the text are detected, and each line of text is identified and segmented. For the last line, accurate size information is obtained by measuring its actual rendering width. In order to optimize computing efficiency, this application avoids unnecessary DOM operations during the measurement process, reduces page reflow and redrawing, and thus improves performance. In addition, by testing on different browsers and devices, the consistency of the solution in various environments is ensured. Finally, the method provided by this application can not only accurately handle dynamic content and complex typesetting, but also optimize the loading and rendering performance of the page, adapt to the needs of responsive design, and provide a better user experience.
[0032] Specifically, Figure 2 As shown, the method comprises the following steps:
[0033] Step S202, initializing the selection area.
[0034] First, create a new selection object and set the range to the target text node.
[0035] Step S204, reading the text input by the user.
[0036] Step S206, analyzing the text information and generating each line of information.
[0037] Use JavaScript to split the text into multiple lines, traverse the text content recursively, and find the end node and offset of each line. In this process, get the position information of each line. In practical applications, you can use range objects to get and operate the currently selected text range, and use range objects to further accurately control the position and width of the text.
[0038] Step S208, locating the last row.
[0039] Step S210, measuring the width.
[0040] After obtaining the position information of multiple lines of text, the width of the last line can be measured by obtaining the rectangle information of the last line selection.
[0041] Figure 3 is another method for determining text width of a graphical programming platform for science and technology education according to an embodiment of the present invention, such as Figure 3 As shown, the method comprises the following steps:
[0042] Step S302, initializing the selection range and setting it on the target text node.
[0043] This application implements text width calculation by creating a range object for the text input by the user in a graphical programming platform. The range object is an API for marking a continuous text area in a page, and is used to mark the start and end positions of the selection in the Document Object Model (DOM). Specifically, Figure 4 As shown, the method of initializing the selection range and setting it on the target text node includes the following steps:
[0044] Step S3022, create a range object.
[0045] A range object is created on the target text node. The range object can be operated in the DOM tree of the page to dynamically adjust and measure the text content. The creation of the range object is based on the JavaScript Range interface provided by the browser. Through this interface, text nodes in the page can be obtained and operated to accurately control the selection range.
[0046] Step S3024, initialize the start and end positions of the range object.
[0047] After the range object is created, the start and end positions of the range object are initialized. The start position is the beginning of the text entered by the user, and the end position is the end of the text. By setting the start and end positions of the range object, the selection range entered by the user can be marked. For example, when a user enters a piece of text in the programming platform, the platform automatically updates the start and end points of the range object by listening to the user's input actions to ensure that the selection range can accurately reflect the currently entered text. Since the length of the text entered by the user varies, the position of the range object can be dynamically adjusted to adapt to these changes. In this way, the platform can accurately capture the actual position of the text and ensure that the subsequent width measurement operation can be accurate.
[0048] Step S3026, identification and binding of target text nodes.
[0049] Before initializing the selection range, determine the target position of the text node. In the graphical programming platform, the text node corresponds to the code or instruction document entered by the user. The platform automatically identifies the text node through JavaScript or the DOM operation API of the relevant programming language, and binds the range object to the correct node. In this way, it can be ensured that the range object can accurately capture the user's input without interfering with other content on the page. Usually, the text entered by the user is not limited to a single line, but involves automatic line wrapping, multi-line display, etc. For this reason, when binding, the range object needs to be able to handle cross-line text nodes to ensure that it can correctly identify the position and range of each line of text.
[0050] Step S304, reading the user input text and dividing it into multiple lines of text.
[0051] After initializing the selection range and setting the target text node, the next step is to read the user's input text and split it into multiple lines according to the line break rules. Specifically, Figure 5 As shown, the following steps are included:
[0052] Step S3042, read the text content.
[0053] When the user enters text in the graphical programming platform, the platform captures the user input information in real time. For example, by listening to the user's input events, the platform obtains each character input by the user in a timely manner and loads these characters into the range object. By operating the range object, the platform can obtain the complete text content in the selection area and prepare for subsequent processing.
[0054] When reading text content, the platform must not only capture explicit characters (such as letters, numbers, etc.), but also recognize implicit characters such as spaces, line breaks, etc. Implicit characters are crucial for text layout, especially when processing line breaks and measuring width, as they determine how the text is divided into lines.
[0055] Step S3044, segmentation of multiple lines of text.
[0056] After the platform reads the complete user input text, it will split the text according to the line breaking rules. The text in the graphical programming platform usually automatically wraps according to the width of the screen. To this end, the platform needs to dynamically determine the end position of each line of text based on the width of the display area.
[0057] In some embodiments, the platform can recursively traverse the text nodes, gradually find the end node and offset of each line of text, and segment the text according to this information. The method of recursively traversing the text nodes can handle complex text layout situations, such as nested text nodes, multi-level structures, etc.
[0058] In some other embodiments, line breaks can also be performed based on the width limit of the display area. The platform detects the actual width of the text (for example, by measuring the rendering size of the text) and automatically inserts a line break to divide the text into multiple lines when the text width exceeds the display area. Alternatively, the text can be divided according to the line break input by the user. If the user manually inputs the line break, the platform will also divide the text according to the user's instructions. At this time, the width of each line of text will not exceed the width of the display area.
[0059] Step S3046, obtaining line break point detection and text position information.
[0060] In order to accurately segment the text, the line break points in the text are detected. The line break point is the place where the text automatically wraps because it exceeds the width limit. In the process of detecting the line break point, the platform must not only consider the explicit line break characters, but also the automatic line breaks caused by the layout. By detecting the line break points, the platform can identify the starting and ending positions of each line of text. For each line of text, the platform records its starting node, ending node and its offset in the page.
[0061] Step S306, obtaining the width of the last line of text.
[0062] After obtaining the position information of each line of text, the width of the last line of text is measured next. Compared with other lines, the width of the last line is usually affected by special circumstances, such as not completely filling the display area. Therefore, the width of the last line needs to be measured separately.
[0063] Specifically, first, determine the range of the last line of text. In order to measure the width of the last line, first find the text range of the last line through the range object. The platform will locate the start and end positions of the last line from the segmented multi-line text and set them as the current range. In this way, the platform can determine the selection range of the last line.
[0064] Next, get the rectangle information of the last line. After determining the range of the last line of text, the platform calls the getBoundingClientRect() method to get the rectangle information of the last line of text. The rectangle information includes the width and height of the text and its position information in the page. By getting the rectangle information of the last line of text, the platform can accurately calculate the actual rendering width of the line of text. Since the last line of text may not completely occupy the display area, its width may be smaller than other lines. Therefore, the platform needs to dynamically calculate the actual rendering width of the last line. Dynamicity ensures that the width of the text can adapt to different input situations, especially in responsive design.
[0065] By analyzing the rectangle information of the last line, the platform can ensure that the width measurement of the last line remains consistent even across different devices or browsers.
[0066] Step S308: determine the total width of the text input by the user.
[0067] After obtaining the width of the last line of text, the platform combines the width information of all lines of text to determine the total width of the text entered by the user. In order to adapt to different devices and screen sizes, the total width of the text can be dynamically adjusted according to the changes in the display area. For example, in the case of responsive design, the display area of the text may change as the screen size changes. By calculating the total width of the text in real time, the platform can dynamically adjust the position and layout of the text block to ensure that the display effect on different devices is always consistent.
[0068] After calculating the total width of the text input by the user, the platform returns the width information to the caller and adjusts or optimizes the text display as needed. For example, the platform can adjust the size of the programming module according to the text width to ensure that users can get the best input and display experience in the platform.
[0069] Through the above steps, the embodiment of the present invention can accurately measure the width of the text input by the user, and dynamically adjust the layout and display effect of the text according to different input situations. The method provided by this application is not only applicable to the graphical programming platform in science and technology education, but also can be applied to other scenarios that require accurate text processing and layout optimization.
[0070] The present application embodiment also provides a rendering method for a graphical programming platform for science and technology education, such as Figure 6 Said method comprises the following steps:
[0071] Step S602, obtaining the total width of the text input by the user.
[0072] The total width of the text input by the user is determined by using the text width determination method described above, which will not be described in detail here.
[0073] Step S604: Rendering the text area of the graphical programming platform based on the total width.
[0074] 1) Text instantiation and location allocation.
[0075] First, a virtual instance of the text area is generated. The instance is assigned corresponding spatial position information according to the total width of the text entered by the user and managed through an independent identifier. In this way, the text area can be dynamically laid out and arranged based on the text width entered by the user to ensure the rationality of the display on different devices and screen resolutions.
[0076] 2) Rendering identifiers and cropping operations.
[0077] A rendering identifier is generated based on the physical location and display properties of the text area, and a cropping operation is performed by matching the rendering identifier with the corresponding cropping identifier. The cropping process ensures that only the area related to the user input text is rendered, optimizes rendering efficiency, and reduces unnecessary resource consumption. After the cropping operation, the system only renders the visible part of the user input text to ensure that the text content can be clearly presented on the platform.
[0078] 3) View configuration and rendering scene setting.
[0079] After the cropping operation is completed, the rendering scene is set by configuring the orthographic camera and setting the perspective cropping ratio parameters. The perspective cropping ratio parameters include the association between the perspective aspect ratio and the screen resolution, so as to ensure that the text entered by the user can be displayed correctly on different devices and screen sizes. Through the dynamic adjustment of the camera, the system can adapt to the rendering requirements under different resolutions, ensuring that the text area always maintains the best visual state.
[0080] 4) Real-time update and synchronous display.
[0081] Based on the text content entered by the user, the system updates the text area in real time to ensure that the content entered by the user during the operation can be reflected in the rendering result in a timely manner. The real-time update function of the text area ensures that every character entered by the user on the programming platform can be accurately displayed, avoiding delays or display errors.
[0082] 5)Vertex transformation matrix optimization.
[0083] In order to further improve the efficiency and accuracy of text rendering, the system introduces dynamic optimization of the vertex transformation matrix. During the text rendering process, the system adjusts the vertex coordinates according to the actual size and offset of the text area. This process ensures that each character in the text area can be accurately positioned when rendered and is consistent with the actual position entered by the user. This optimization method ensures the continuity and accuracy of text rendering and avoids misalignment or blurring in text display.
[0084] Through the above steps, the text area rendering method provided in this embodiment ensures that the graphical programming platform in science and technology education can accurately adapt the width and display rendering of the text input by the user. By introducing intelligent cropping, dynamic camera and vertex transformation matrix optimization technology, the system enables the text area to be presented clearly and accurately on different devices, thereby improving the user experience on the platform.
[0085] The present application also provides a text width determination device for a graphical programming platform for science and technology education, such as Figure 7 As shown, it includes: an initialization module 72, which is configured to initialize the selection range and set the selection range on the target text node; a position determination module 74, which is configured to read the user input text in the selection range, divide the user input text into multiple lines of text, and determine the position information of the multiple lines of text, wherein the position information includes the starting position, the ending position, and the width of each line of text; a width measurement module 76, which is configured to locate the last line of the multiple lines of text based on the position information of the multiple lines of text, and measure the width of the last line by obtaining the rectangular information of the selection area of the last line; a total width calculation module 78, which is configured to determine the total width of the user input text based on the width of the last line and the width of each line of text except the last line.
[0086] It should be noted that the text width determination device for the graphical programming platform for science and technology education provided in the above embodiment is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the text width determination device for the graphical programming platform for science and technology education provided in the above embodiment and the text width determination method embodiment for the graphical programming platform for science and technology education belong to the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0087] Figure 8 FIG. 1 shows a schematic diagram of the structure of an electronic device suitable for implementing the embodiment of the present disclosure. It should be noted that: Figure 8The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0088] like Figure 8 As shown, the electronic device includes a central processing unit (CPU) 1001, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage part 1008 into a random access memory (RAM) 1003. In RAM 1003, various programs and data required for platform operation are also stored. CPU 1001, ROM 1002 and RAM 1003 are connected to each other via a bus 1004. An input / output (I / O) interface 1005 is also connected to the bus 1004.
[0089] The following components are connected to the I / O interface 1005: an input section 1006 including a keyboard, a mouse, etc.; an output section 1007 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 1008 including a hard disk, etc.; and a communication section 1009 including a network interface card such as a LAN card, a modem, etc. The communication section 1009 performs communication processing via a network such as the Internet. A drive 1010 is also connected to the I / O interface 1005 as needed. A removable medium 1011, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1010 as needed, so that a computer program read therefrom is installed into the storage section 1008 as needed.
[0090] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 1009, and / or installed from the removable medium 1011. When the computer program is executed by the central processing unit (CPU) 1001, various functions defined in the method and apparatus of the present application are executed. In some embodiments, the electronic device may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.
[0091] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A method for determining text width of a graphical programming platform for science and technology education, characterized in that: include: Initialize a selection range, and set the selection range on a target text node; Read the user input text in the selected area, divide the user input text into multiple lines of text, and determine the position information of the multiple lines of text, wherein the position information includes the starting position, the ending position, and the width of each line of text; Based on the position information of the multiple lines of text, locate the last line of the multiple lines of text, and measure the width of the last line by obtaining the rectangular information of the selected area of the last line; The total width of the user input text is determined based on the width of the last line and the width of each line of text except the last line.
2. The method according to claim 1, characterized in that Initialize the selection range, including: On the target text node, creating a range object, wherein the range object represents a continuous area or range of the graphical programming platform; The start position and the end position of the range object are set to initialize the selection range, wherein the start position and the end position of the range object are used to mark the range of the user input text.
3. The method according to claim 2, characterized in that Segmenting the user input text into multiple lines of text and determining position information of the multiple lines of text, including: gradually adjusting the start position and the end position of the range object, detecting the line break point of the user input text, and identifying and segmenting each line of text; Based on each of the segmented lines of text, position information of the multiple lines of text is determined.
4. The method according to claim 3, characterized in that Detecting the line break point of the user input text, identifying and segmenting each line of text, including: Recursively traverse the user input text to identify the line break point and offset of each line of text; Based on the line break point and the offset, each line of text is identified and segmented.
5. The method according to claim 1, characterized in that Locating the last line of the multiple lines of text based on the position information of the multiple lines of text, and measuring the width of the last line by obtaining the rectangular information of the selection area of the last line, including: Based on the position information of the multiple lines of text, find the text range of the last line using the range object; The width of the last line is measured by obtaining the rectangle information of the selection area of the text range of the last line.
6. A rendering method for a graphical programming platform for science and technology education, characterized in that: include: Based on the total width determined by the method of any one of claims 1 to 5, a text area of the graphical programming platform is rendered.
7. A text width determination device for a graphical programming platform for science and technology education, characterized in that: include: An initialization module is configured to initialize a selection range and set the selection range on a target text node; a position determination module, configured to read the user input text in the selection area, divide the user input text into multiple lines of text, and determine the position information of the multiple lines of text, wherein the position information includes the starting position, the ending position, and the width of each line of text; A width measurement module is configured to locate the last line of the multiple lines of text based on the position information of the multiple lines of text, and measure the width of the last line by obtaining the rectangular information of the selected area of the last line; The total width calculation module is configured to determine the total width of the user input text based on the width of the last line and the width of each line of text except the last line.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein when the program is executed, the device where the computer-readable storage medium is located is controlled to execute the method according to any one of claims 1 to 6.
9. A computer device, characterized in that: include: Memory and processor, The memory stores a computer program; The processor is used to execute the computer program stored in the memory, and when the computer program is run, the processor is enabled to execute the method according to any one of claims 1 to 6.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.