Guide component generation method, terminal equipment and storage medium
By building a global and step configuration table, monitoring the browser window size in real time, and generating hollow mask layers and guidance cards, the limitations of existing guidance components are solved, flexible spacing configuration and multi-mask layer overlay are achieved, providing accurate and The complex guidance effect improves the adaptability and aesthetics of the guidance component.
Patent Information
- Application Number
- CN202410555774.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-07
- Publication Date
- 2024-08-30
AI Technical Summary
Existing guidance components have limitations in position definition, spacing configuration, custom coordinates and mask layer functions, and cannot flexibly adapt to the needs of different scenarios, resulting in less accurate and beautiful guidance effects.
By constructing a global configuration table and a step configuration table, the browser window size is monitored in real time, hollow mask layers and guide cards are generated, and multiple mask layer overlays are supported to realize custom coordinates and priority direction settings, and flexibly configure spacing and rendering. opportunity.
It realizes flexible guidance components to adapt to the needs of different scenarios, provides more accurate and complex highlight logos, and ensures the exquisiteness and ease of use of the guidance effect.
Smart Images

Figure CN118567740A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of network technology, and in particular to a boot component generation method, terminal equipment and storage medium. Background Art
[0002] The purpose of the novice guide is to provide users with a series of instructions and help when they use the product for the first time, so that they can quickly become familiar with the product functions and master the operation of the product. However, the existing guide components have some limitations, which bring great inconvenience to the use. The common limitations are as follows:
[0003] (1) Limited position definition: The position of the guide card can only be defined relative to the target. When there is insufficient space, the position can only be randomly selected.
[0004] (2) Insufficient spacing configuration: The spacing between the guide card and the target cannot be customized, or the spacing in a specified direction can only be fixed, making it impossible to dynamically identify and calculate according to specific circumstances.
[0005] (3) Customized coordinate restrictions: Currently, the position can only be defined based on the target position, and free configuration independent of the target is not possible.
[0006] (4) Limitations of the mask layer function: Currently, only custom mask layer styles are supported. It is not possible to achieve the superposition effect of multiple mask layers to form a more exquisite and eye-catching cascade highlight logo. Summary of the invention
[0007] In order to solve the above problem, the present invention proposes a boot component generation method, a terminal device and a storage medium.
[0008] The specific plan is as follows:
[0009] A method for generating a boot component comprises the following steps:
[0010] Construct a global configuration table and a step configuration table corresponding to each step. The global configuration table is used to record the style information of the mask layer, and the step configuration table is used to record the target element used for guidance in the corresponding step and the relevant information of the guidance card used for guidance; the relevant information of the target element includes the unique code, size information, position information and highlight style information of the target element;
[0011] After booting begins, monitor the browser window size in real time and cache it;
[0012] When the guide reaches a certain step, do the following:
[0013] According to the relevant information of the target element recorded in the step configuration table corresponding to this step, calculate the current size information and position information of the target element, generate a hollow mask layer of the size of the target element based on the current size information and position information, and render the hollow mask layer based on the highlight style information in the relevant information of the target element;
[0014] Generate a guide card for the step by combining the location information of the target element and the relevant information of the guide card recorded in the step configuration table;
[0015] A mask layer of a corresponding size is generated according to the size of the browser window, and the mask layer is rendered based on the style information of the mask layer recorded in the global configuration table.
[0016] Furthermore, it also includes building an event bus to record the execution order of each step, and after receiving the running status of each step, return the subsequent steps to be executed.
[0017] Furthermore, real-time monitoring of the browser window size is achieved by registering the resize event of the browser window.
[0018] Furthermore, when the guidance proceeds to a certain step, it also includes: judging whether a mask layer click event is registered for the step based on the step configuration table, and if so, generating a click mask layer.
[0019] Furthermore, when the guidance proceeds to a certain step, it also includes: judging whether the step includes a custom mask layer component based on the step configuration table, and if so, generating a custom mask layer.
[0020] Furthermore, the relevant information of the guide card includes size information of the guide card, distance from the target element, and a set of preferred directions; and the process of generating the guide card based on the relevant information includes the following steps:
[0021] According to the position information of the current element, calculate the four distances between the target element and the upper, lower, left and right sides of the browser window;
[0022] Based on the four spacings and combined with the size information of the guide card, a set of available directions of the guide card is obtained;
[0023] Based on the ranking order of the directions in the preferred direction set, the direction with the highest ranking is selected from the available direction set as the selected direction;
[0024] Generates a guide card based on its size information, the selected direction, and the distance from the target element.
[0025] Furthermore, the relevant information of the guide card includes the configured guide card position information. In the process of generating the guide card, the guide card is generated directly based on the guide card position information.
[0026] Furthermore, it also includes real-time monitoring of the position size and position change of the target element by registering the resize event of the target element. When the position size and position change of the target element is monitored, the position information of the guide card is updated based on the changed size information and position information.
[0027] A boot component generates a terminal device, comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned method of the embodiment of the present invention when executing the computer program.
[0028] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method described above in an embodiment of the present invention are implemented.
[0029] The present invention adopts the above technical solution to solve the limitations of the existing guidance components. The guidance components can flexibly adapt to different scene requirements and achieve a more accurate guidance effect. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1 Shown is a flow chart of a method according to a first embodiment of the present invention.
[0031] Figure 2 Shown is a schematic diagram of the target element and guide card generated in this embodiment. DETAILED DESCRIPTION
[0032] To further illustrate various embodiments, the present invention provides drawings. These drawings are part of the disclosure of the present invention, which are mainly used to illustrate the embodiments and can be used in conjunction with the relevant descriptions in the specification to explain the operating principles of the embodiments. With reference to these contents, ordinary technicians in this field should be able to understand other possible implementations and advantages of the present invention.
[0033] The present invention will now be further described with reference to the accompanying drawings and specific implementation methods.
[0034] Embodiment 1:
[0035] The embodiment of the present invention provides a method for generating a guide component, such as Figure 1 As shown, the method comprises the following steps:
[0036] S1: construct a global configuration table and a step configuration table corresponding to each step. The global configuration table is used to record the style information of the mask layer, and the step configuration table is used to record the target element used for guidance in the corresponding step and the relevant information of the guidance card used for guidance.
[0037] In this embodiment, the relevant information of the target element includes the unique code (ID), size information, location information and highlight style information of the target element; the relevant information of the guide card includes the size information of the guide card, the distance from the target element and the preferred direction set. The following code is an example of a step configuration table.
[0038] const steps = [
[0039] {
[0040] / / Elements that need to be highlighted
[0041] selector:()=>document.querySelector('target'),
[0042] The spacing will be calculated in real time according to the current direction
[0043] gap:16,
[0044] / / Listen to the size changes of the element to update the position in real time
[0045] resizeObservables:[document.querySelector('target')],
[0046] / / Whether to automatically locate to the highlighted area
[0047] scrollInView:false,
[0048] / / Preferred direction set, if there is enough space, the corresponding direction order of this configuration will be given priority
[0049] preferencePositions:['top','left','right'],
[0050] / / You can get the current positioning context information to customize the position coordinates of the guide card overridePosition:(coord,autoPosition,sizes,helperRect)=>{
[0051] const{bottom,left,width,height}=sizes;
[0052] const{width:helperWidth}=helperRect;
[0053] / / Position the card at the upper right corner of the highlighted area
[0054] return[
[0055] left+width-helperWidth,
[0056] bottom-height, ];
[0058] },
[0059] }
[0060] ].
[0061] In the above steps, the configuration table also includes the customized guide card position information. When the customized position is required, the configuration of this part of the content can be added. When the customized guide card position information exists, it is preferred to use the position information to generate the guide card.
[0062] S2: After booting begins, monitor the browser window size in real time and cache it.
[0063] In this embodiment, the browser window is monitored in real time by registering the resize event of the browser window. When the browser window size change is detected, the cached browser window size data is updated.
[0064] S3: When the guidance proceeds to a certain step, the operations of S101 to S103 are executed.
[0065] S101: According to the relevant information of the target element recorded in the step configuration table corresponding to this step, calculate the current size information and position information of the target element, generate a hollow mask layer of the size of the target element based on the current size information and position information, and render the hollow mask layer based on the highlight style information in the relevant information of the target element to achieve highlight display of the target element.
[0066] When the hollow mask layer is generated, the mask of the browser window is first generated by svg, and then the area where the current target element is located is deducted. The effect of highlighting the target element in this embodiment is as follows Figure 2 As shown, Figure 2 The sample application in the upper middle is the target element, and the target element is highlighted by the rectangular frame around it.
[0067] S102: Generate a guide card for the step by combining the location information of the target element and the relevant information of the guide card recorded in the step configuration table.
[0068] S103: Generate a mask layer of a corresponding size according to the size of the browser window, and render the mask layer based on the style information of the mask layer recorded in the global configuration table.
[0069] In this embodiment, when generating a guide card, if the customized guide card position information is recorded in the step configuration table, it is preferred to use the position information to generate the guide card; when the customized guide card position information is not recorded, S201-S204 is used to generate the guide card, and at this time, the configuration items such as the size information of the guide card in the step configuration table, the distance from the target element, and the preferred direction set are required. Figure 2 The lower component in the is the generated guide card.
[0070] S201: Calculate four distances between the target element and the upper, lower, left, and right sides of the browser window according to the position information of the current element.
[0071] S202: Based on the four spacings and in combination with the size information of the guide card, obtain a set of available directions of the guide card.
[0072] The available directions in the available direction set must satisfy that the distance between the target element in the direction and the browser window can accommodate the guide card, and the distance between the guide card and the target element satisfies the distance from the target element recorded in the step configuration table.
[0073] S203: Based on the arrangement order of the directions in the preferred direction set, select the direction with the highest ranking from the available direction set as the selected direction.
[0074] S204: Generate a guide card according to the size information of the guide card, the selected direction, and the distance from the target element.
[0075] In order to better control the execution of each step, this embodiment also includes building an event bus to record the execution order of each step, and after receiving the running status of each step, return the subsequent steps to be executed. The running status can be clicking the previous step, clicking the next step, etc. If the next step is clicked, the event bus searches for the corresponding next step according to the execution order of each step recorded and returns it.
[0076] In addition, in this embodiment, the timing of opening and closing the guide can also be manually controlled. For example, when entering the next step, the guide is closed first, and after the interface data is returned, the guide is opened for rendering to achieve more refined control.
[0077] In this embodiment, when the guidance proceeds to a certain step, it also includes S104 and / or S105.
[0078] In S104, it is determined based on the step configuration table whether a mask layer click event is registered for the step, and if so, a click mask layer is generated.
[0079] In S105, it is determined based on the step configuration table whether the step includes a custom mask layer component, and if so, a custom mask layer is generated.
[0080] In addition, this embodiment also includes real-time monitoring of the position size and position change of the target element by registering the resize event of the target element. When the position size and position change of the target element are monitored, the position information of the guide card is updated based on the changed size information and position information.
[0081] The embodiments of the present invention have the following beneficial effects:
[0082] (1) Freely configurable spacing: Different from the existing guide components, this embodiment provides a free configuration of the spacing between the highlight area and other elements. Users can flexibly adjust the spacing according to actual needs to meet different layout requirements.
[0083] (2) Supporting the overlay of multiple mask layers: The guidance component of this embodiment can achieve the overlay effect of multiple mask layers, making the highlight mark more complex and exquisite. By overlaying mask layers, multiple key elements can be highlighted at the same time in one guidance step.
[0084] (3) Flexible positioning and priority: The guidance component of this embodiment provides custom coordinate and priority direction settings to accurately control the positioning of the guidance card. Through flexible positioning and priority settings, it can be ensured that the guidance component can accurately guide the user in various scenarios.
[0085] (4) Controllable rendering timing: The rendering timing of the guidance component can be freely adjusted when it is used, and the guidance process can be finely controlled to achieve better convenience and ease of use.
[0086] Embodiment 2:
[0087] The present invention also provides a boot component generating terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps in the above method embodiment of embodiment 1 of the present invention when executing the computer program.
[0088] Further, as an executable solution, the boot component generating terminal device may be a computing device such as a desktop computer, a notebook, a PDA, and a cloud server. The boot component generating terminal device may include, but not limited to, a processor and a memory. Those skilled in the art may understand that the composition structure of the boot component generating terminal device described above is only an example of the boot component generating terminal device, and does not constitute a limitation on the boot component generating terminal device, and may include more or less components than the above, or a combination of certain components, or different components. For example, the boot component generating terminal device may also include input and output devices, network access devices, buses, etc., and the embodiments of the present invention do not limit this.
[0089] Further, as an executable solution, the processor may be a central processing unit (CPU) or other general-purpose processors. The general-purpose processor may be a microprocessor or any conventional processor, etc. The processor is the control center of the boot component generating terminal device, and uses various interfaces and lines to connect various parts of the entire boot component generating terminal device.
[0090] The memory can be used to store the computer program and / or module, and the processor realizes the various functions of the boot component generating the terminal device by running or executing the computer program and / or module stored in the memory, and calling the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system and at least one application required for a function; the data storage area can store data created according to the use of the mobile phone, etc. In addition, the memory can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0091] The present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above method in the embodiment of the present invention are implemented.
[0092] If the module / unit integrated by the boot component to generate the terminal device is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present invention implements all or part of the process in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory) and software distribution medium, etc.
[0093] Although the present invention has been specifically shown and described in conjunction with the preferred embodiments, it should be understood by those skilled in the art that various changes may be made to the present invention in form and details without departing from the spirit and scope of the present invention as defined by the appended claims, all of which are within the scope of protection of the present invention.
Claims
1. A method for generating a guide component, characterized in that: The following steps are involved: Construct a global configuration table and a step configuration table corresponding to each step. The global configuration table is used to record the style information of the mask layer, and the step configuration table is used to record the target element used for guidance in the corresponding step and the relevant information of the guidance card used for guidance; the relevant information of the target element includes the unique code, size information, position information and highlight style information of the target element; After booting begins, monitor the browser window size in real time and cache it; When the guide reaches a certain step, do the following: According to the relevant information of the target element recorded in the step configuration table corresponding to this step, calculate the current size information and position information of the target element, generate a hollow mask layer of the size of the target element based on the current size information and position information, and render the hollow mask layer based on the highlight style information in the relevant information of the target element; Generate a guide card for the step by combining the location information of the target element and the relevant information of the guide card recorded in the step configuration table; A mask layer of a corresponding size is generated according to the size of the browser window, and the mask layer is rendered based on the style information of the mask layer recorded in the global configuration table.
2. The method for generating a guide component according to claim 1, characterized in that: It also includes building an event bus to record the execution order of each step, and after receiving the running status of each step, return the subsequent steps to be executed.
3. The method for generating a guide component according to claim 1, characterized in that: Real-time monitoring of browser window size is achieved by registering the resize event of the browser window.
4. The method for generating a guide component according to claim 1, characterized in that: When the guidance proceeds to a certain step, it also includes: judging whether a mask layer click event is registered for the step based on the step configuration table, and if so, generating a click mask layer.
5. The method for generating a guide component according to claim 1, characterized in that: When the guidance proceeds to a certain step, it also includes: judging whether the step includes a custom mask layer component based on the step configuration table, and if so, generating a custom mask layer.
6. The method for generating a guide component according to claim 1, characterized in that: The relevant information of the guide card includes the size information of the guide card, the distance from the target element, and the preferred direction set; the process of generating the guide card based on the relevant information includes the following steps: According to the position information of the current element, calculate the four distances between the target element and the upper, lower, left and right sides of the browser window; Based on the four spacings and combined with the size information of the guide card, a set of available directions of the guide card is obtained; Based on the ranking order of the directions in the preferred direction set, the direction with the highest ranking is selected from the available direction set as the selected direction; Generates a guide card based on its size information, the selected direction, and the distance from the target element.
7. The method for generating a guide component according to claim 1, characterized in that: The relevant information of the guide card includes the configured guide card position information. In the process of generating the guide card, the guide card is directly generated based on the guide card position information.
8. The method for generating a guide component according to claim 1, characterized in that: It also includes real-time monitoring of the position size and position change of the target element by registering the resize event of the target element. When the position size and position change of the target element is monitored, the position information of the guide card is updated based on the changed size information and position information.
9. A boot component generates a terminal device, characterized in that: The method comprises a processor, a memory and a computer program stored in the memory and running on the processor, wherein the processor implements the steps of the method according to any one of claims 1 to 8 when executing the computer program.
10. A computer-readable storage medium storing 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 8 are implemented.
Citation Information
Cited By
Implementation method, system and equipment for custom boot layer of operating system and medium
CN120687182A
Drawing method and device for highlight primitives and storage medium
CN120726166A
A method, device and storage medium for drawing a highlight primitive
CN120726166B
