A method and apparatus for focusing on a user interface
By dividing the user interface into initial and final regions and combining the focus coordinate calculation, the focus can be moved efficiently and accurately in the user interface, solving the problems of low efficiency and poor accuracy of focus movement in the prior art and improving the user interface operation experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HUNAN HAPPLY SUNSHINE INTERACTIVE ENTERTAINMENT MEDIA CO LTD
- Filing Date
- 2024-07-03
- Publication Date
- 2026-07-03
AI Technical Summary
In existing technologies, the focus movement of user interfaces is inefficient and inaccurate, especially when the interface elements are complex or numerous, which increases the difficulty of user operation and enhances fatigue.
By identifying multiple interface elements of the user interface, an initial region is defined, and then further divided into final regions based on the information of the sub-elements. It is determined whether the current final region and the target final region are the same. If they are different, movement between regions is performed until they are consistent, and then movement within the region is performed. Precise movement is achieved by calculating the focus coordinates.
It improves the efficiency and accuracy of focus movement, reduces unnecessary movement steps, lowers the difficulty of user operation, and enhances the user experience.
Smart Images

Figure CN118695043B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of remote control technology, and more particularly to a method and apparatus for focusing a user interface. Background Technology
[0002] With the development of intelligent technology, the interactive operation of user interfaces on devices such as smart TVs is becoming increasingly complex. The user interface interaction mainly relies on the buttons on the remote control to move the focus point on the interface, thereby achieving the purpose of operating the user interface. The remote control uses four buttons—up, down, left, and right—to move the focus point. The focus point can only be moved vertically up (down) and horizontally left (right) sequentially; it cannot be moved in any arbitrary direction.
[0003] Currently, user interfaces typically involve multiple interface elements, and focus is moved from one element to another.
[0004] However, in some layouts, the interface elements are complex or numerous, requiring multiple key presses to move the focus, resulting in low efficiency of focus movement. This also increases the difficulty and fatigue of user operation, leading to lower accuracy of focus movement. Summary of the Invention
[0005] In view of the above problems, this application provides a method and apparatus for focusing on a user interface. To improve the efficiency and accuracy of focusing, the specific solution is as follows:
[0006] The first aspect of this application provides a method for moving the focus of a user interface, comprising:
[0007] Determine multiple interface elements of the user interface, including the current focus and the target focus;
[0008] Each of the interface elements is treated as a child element. The parent element of each child element is then looked up, and child elements belonging to the same parent element are assigned to the same initial area.
[0009] For each initial region, based on the information of the sub-elements included in the initial region, the initial region is divided to obtain multiple final regions;
[0010] Determine whether the current final region and the target final region are the same final region, wherein the current final region is the final region where the current focus is located, and the target final region is the final region where the target focus is located;
[0011] If the current final region and the target final region are not the same final region, then based on the obtained coordinates of the current final region and the target final region, the movement direction between regions is determined. According to the movement direction between regions, the current focus is moved from the current final region to the adjacent final region of the current final region, and the current final region is updated to the adjacent final region. Then, the step of determining whether the current final region and the target final region are the same final region is returned to be executed until the current final region and the target final region are the same final region.
[0012] Based on the obtained coordinates of the current focus and the target focus, the movement direction and movement distance within the region are calculated, and the current focus is moved to the target focus according to the movement direction and movement distance within the region.
[0013] In one possible implementation, the information of the sub-elements included in the initial region includes: the coordinates of each sub-element included in the initial region and the total number of sub-elements included in the initial region;
[0014] Based on the information of the sub-elements included in the initial region, the initial region is divided to obtain multiple final regions, including:
[0015] Based on the coordinates of each sub-element included in the initial region and the total number of sub-element included in the initial region, determine whether the initial region is a preset irregular region;
[0016] If the initial region is the preset irregular region, then the initial region is divided based on the coordinates of each sub-element included in the initial region to obtain at least one intermediate region;
[0017] Each of the intermediate regions is taken as the current intermediate region: based on the coordinates of each sub-element included in the current intermediate region and the coordinates of each sub-element included in other intermediate regions, it is determined whether the current intermediate region is a preset intersection region, and the other intermediate regions are intermediate regions other than the current intermediate region.
[0018] If the current intermediate region is the preset intersection region, then the current intermediate region is divided based on the coordinates of each sub-element included in the current intermediate region to obtain the final region.
[0019] In one possible implementation, the coordinates of each sub-element included in the initial region include the maximum x-coordinate of each sub-element included in the initial region, the minimum x-coordinate of each sub-element included in the initial region, the maximum y-coordinate of each sub-element included in the initial region, and the minimum y-coordinate of each sub-element included in the initial region.
[0020] The step of determining whether the initial region is a preset irregular region based on the coordinates of each sub-element included in the initial region and the total number of sub-element included in the initial region includes:
[0021] Based on the maximum x-coordinate, minimum x-coordinate, maximum y-coordinate, and minimum x-coordinate of each sub-element included in the initial region, calculate the center x-coordinate and center y-coordinate of each sub-element included in the initial region.
[0022] The sub-elements with the same center x-coordinate included in the initial region are determined as a sub-element row, and the number of sub-element rows is obtained;
[0023] Sub-elements with the same center ordinate in the initial region are defined as a sub-element column, thus obtaining the number of sub-element columns;
[0024] Determine whether the product of the number of rows of the sub-element minus 1 and the number of columns of the sub-element is greater than the total number of sub-elements included in the initial region;
[0025] If the product of the number of rows of the sub-element minus 1 and the number of columns of the sub-element is greater than the total number of sub-elements included in the initial region, then the initial region is determined to be the preset irregular region;
[0026] If the product of the number of sub-rows of the sub-element and the number of columns of the sub-element is not greater than the total number of sub-elements included in the initial region, then it is determined whether the initial region satisfies the first preset condition. The first preset condition is that the minimum value of the center ordinate of each sub-element included in the initial region in each sub-element row is the same, or the minimum value of the center abscissa of each sub-element included in the initial region in each sub-element column is the same.
[0027] If the initial region does not meet the first preset condition, then the initial region is determined to be the preset irregular region.
[0028] In one possible implementation, determining whether the current intermediate region is a preset intersection region based on the coordinates of each sub-element included in the current intermediate region and the coordinates of each sub-element included in other intermediate regions includes:
[0029] Determine whether the coordinates of at least one child element included in the current intermediate region are the same as the coordinates of at least one child element included in other intermediate regions;
[0030] If the coordinates of at least one child element included in the current intermediate region are the same as the coordinates of at least one child element included in other intermediate regions, then the current intermediate region is determined to be the preset intersection region.
[0031] In one possible implementation, the coordinates of each sub-element included in the current intermediate region include the maximum x-coordinate of each sub-element included in the current intermediate region, the minimum x-coordinate of each sub-element included in the current intermediate region, the maximum y-coordinate of each sub-element included in the current intermediate region, and the minimum y-coordinate of each sub-element included in the current intermediate region.
[0032] The step of dividing the current intermediate region based on the coordinates of each sub-element included in the current intermediate region to obtain the final region includes:
[0033] The maximum x-coordinate, minimum x-coordinate, maximum y-coordinate, and minimum y-coordinate of the current intermediate region are determined from the maximum x-coordinate, minimum x-coordinate, maximum y-coordinate, and minimum y-coordinate of each sub-element included in the current intermediate region, respectively.
[0034] The current intermediate region is divided according to its maximum x-coordinate, minimum x-coordinate, maximum y-coordinate, and minimum y-coordinate to obtain the final region.
[0035] In one possible implementation, the coordinates of the current final region include the maximum x-coordinate, the minimum x-coordinate, the maximum y-coordinate, and the minimum y-coordinate of the current final region, and the coordinates of the target final region include the maximum x-coordinate, the minimum x-coordinate, the maximum y-coordinate, and the minimum y-coordinate of the target final region;
[0036] Determining the direction of movement between regions based on the acquired coordinates of the current final region and the target final region includes:
[0037] Based on the maximum and minimum x-coordinates of the current final region, the center x-coordinate of the current final region is calculated, and based on the maximum and minimum x-coordinates of the target final region, the center x-coordinate of the target final region is calculated.
[0038] Based on the center x-coordinate of the current final region and the center x-coordinate of the target final region, the horizontal movement direction and horizontal movement distance between regions are calculated.
[0039] Based on the maximum and minimum ordinates of the current final region, the center ordinate of the current final region is calculated, and based on the maximum and minimum ordinates of the target final region, the center ordinate of the target final region is calculated.
[0040] Based on the center ordinate of the current final region and the center ordinate of the target final region, the vertical movement direction and vertical movement distance between regions are calculated.
[0041] By comparing the horizontal movement distance between the regions and the vertical movement distance between the regions, a selectable movement direction between the regions is determined, and based on the selectable movement direction between the regions, the movement direction between the regions is determined. The selectable movement direction between the regions is one of the horizontal movement direction between the regions and the vertical movement direction between the regions.
[0042] In one possible implementation, the coordinates of the optional adjacent final region include the maximum x-coordinate of the optional adjacent final region, the minimum x-coordinate of the optional adjacent final region, the maximum y-coordinate of the optional adjacent final region, and the minimum y-coordinate of the optional adjacent final region.
[0043] Determining the inter-regional movement direction based on the selectable inter-regional movement direction includes:
[0044] If the movement direction between the selectable regions is the horizontal movement direction between the regions, it is determined whether there is a selectable adjacent final region for the current final region. The relationship between the coordinates of the current final region and the coordinates of the selectable adjacent final region satisfies a second preset condition. The second preset condition is used to indicate a first relationship, a second relationship, and a third relationship. The first relationship is the relationship between the maximum ordinate of the current final region and the minimum ordinate of the selectable adjacent final region. The second relationship is the relationship between the minimum ordinate of the current final region and the maximum ordinate of the selectable adjacent final region. The third relationship is the relationship between the center abscissa of the current final region and the calculated center abscissa of the selectable adjacent final region. If the condition is satisfied, the movement direction between the regions is determined to be the horizontal movement direction between the regions. If the condition is not satisfied, the movement direction between the regions is determined to be the vertical movement direction between the regions.
[0045] If the movement direction between the selectable regions is the vertical movement direction between the regions, it is determined whether there is a selectable adjacent final region for the current final region. The relationship between the coordinates of the current final region and the coordinates of the selectable adjacent final region satisfies a third preset condition. The third preset condition is used to indicate a fourth, fifth, and sixth relationship. The fourth relationship is the relationship between the maximum horizontal coordinate of the current final region and the minimum horizontal coordinate of the selectable adjacent final region. The fifth relationship is the relationship between the minimum horizontal coordinate of the current final region and the maximum horizontal coordinate of the selectable adjacent final region. The sixth relationship is the relationship between the center horizontal coordinate of the current final region and the calculated center horizontal coordinate of the selectable adjacent final region. If the condition is satisfied, the movement direction between the regions is determined to be the vertical movement direction between the regions. If the condition is not satisfied, the movement direction between the regions is determined to be the horizontal movement direction between the regions.
[0046] In one possible implementation, the coordinates of the current focus include the x-coordinate and y-coordinate of the current focus, the coordinates of the target focus include the x-coordinate and y-coordinate of the target focus, the movement direction within the region includes the horizontal movement direction within the region and the vertical movement direction within the region, and the movement distance within the region includes the horizontal movement distance within the region and the vertical movement distance within the region.
[0047] The calculation of the movement direction and movement distance within the region based on the obtained coordinates of the current focus and the target focus includes:
[0048] Based on the x-coordinate of the current focus and the x-coordinate of the target focus, the horizontal movement direction and the horizontal movement distance within the region are calculated.
[0049] Based on the ordinate of the current focus and the ordinate of the target focus, the vertical movement direction and the vertical movement distance within the region are calculated.
[0050] In one possible implementation, after calculating the movement direction and movement distance within the region based on the acquired coordinates of the current focus and the target focus, and moving the current focus to the target focus according to the movement direction and movement distance within the region, the method further includes:
[0051] Determine whether the coordinates of the current focus are the same as the coordinates of the target focus;
[0052] If the coordinates of the current focus are not the same as the coordinates of the target focus, then return to the previous step to determine whether the current final region and the target final region are the same final region.
[0053] A second aspect of this application provides a focus-moving device for a user interface, comprising:
[0054] A determining unit is used to determine multiple interface elements of the user interface, including the current focus and the target focus;
[0055] The first division unit is used to treat each of the interface elements as child elements, reverse look up the parent element of each child element, and divide the child elements belonging to the same parent element into the same initial area.
[0056] The second division unit is used to divide the initial region based on the information of the sub-elements included in the initial region, to obtain multiple final regions.
[0057] The judgment unit is used to determine whether the current final region and the target final region are the same final region, wherein the current final region is the final region where the current focus is located, and the target final region is the final region where the target focus is located;
[0058] The first moving unit is configured to, if the current final region and the target final region are not the same final region, determine the inter-region moving direction based on the obtained coordinates of the current final region and the target final region, move the current focus from the current final region to the adjacent final region according to the inter-region moving direction, update the current final region to the adjacent final region, and return to execute the step of determining whether the current final region and the target final region are the same final region, until the current final region and the target final region are the same final region;
[0059] The second moving unit is used to calculate the moving direction and moving distance within the region based on the obtained coordinates of the current focus and the target focus, and to move the current focus to the target focus according to the moving direction and moving distance within the region.
[0060] By employing the above technical solution, this application provides a user interface focus movement method and apparatus. First, multiple interface elements of the user interface are determined, including the current focus and the target focus. The user interface is divided into initial regions using these interface elements, and then further divided into final regions using the information of the interface elements. This method is independent of the specific layout of the user interface and can automatically divide regions for different user interfaces. First, the current focus is moved between regions so that the current final region where the current focus is located and the target final region where the target focus is located are in the same final region. This process involves the focus moving between regions, eliminating the need to go through each interface element individually, reducing unnecessary movement steps, and improving focus movement efficiency. Then, the current focus is moved within the same region until it reaches the target focus. When the current focus and the target focus are in the same final region, precise focus movement is achieved based on the focus's coordinates, ensuring the accuracy of the focus movement. Attached Figure Description
[0061] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the originals and elements are not necessarily drawn to scale.
[0062] Figure 1 A flowchart illustrating a user interface focus movement method provided in an embodiment of this application;
[0063] Figure 2 A schematic diagram of a user interface provided for an embodiment of this application;
[0064] Figure 3 A schematic diagram illustrating the layout information of a user interface provided in an embodiment of this application;
[0065] Figure 4 A schematic diagram of multiple interface elements of a user interface provided in an embodiment of this application;
[0066] Figure 5 A schematic diagram illustrating a user interface and its layout information provided in an embodiment of this application;
[0067] Figure 6 A schematic diagram of an initial region provided in an embodiment of this application;
[0068] Figure 7 A schematic diagram of an intermediate region provided in an embodiment of this application;
[0069] Figure 8 A schematic diagram of a final region provided in an embodiment of this application;
[0070] Figure 9 A schematic diagram of another user interface provided for an embodiment of this application;
[0071] Figure 10 This is a schematic diagram illustrating a method for dividing an initial region into multiple final regions based on information about the sub-elements included in the initial region, as provided in an embodiment of this application.
[0072] Figure 11 A schematic diagram of the coordinates of a sub-element provided in an embodiment of this application;
[0073] Figure 12 A schematic diagram illustrating a method for determining the direction of movement between regions based on the obtained coordinates of the current final region and the target final region, as provided in an embodiment of this application.
[0074] Figure 13 A schematic diagram of another final region provided in an embodiment of this application;
[0075] Figure 14 This is a schematic diagram of the structure of a focus-moving device for a user interface provided in an embodiment of this application. Detailed Implementation
[0076] The embodiments of this application are described below with reference to the accompanying drawings. The terminology used in the implementation section of this application is for explaining specific embodiments only and is not intended to limit the scope of this application.
[0077] The embodiments of this application will now be described with reference to the accompanying drawings. Those skilled in the art will recognize that, with technological advancements and the emergence of new scenarios, the technical solutions provided in the embodiments of this application are equally applicable to similar technical problems.
[0078] The terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such terms are interchangeable where appropriate; this is merely a way of distinguishing objects with the same attributes in the embodiments of this application. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion, so that a process, method, system, product, or apparatus that comprises a series of elements is not necessarily limited to those elements, but may include other elements not explicitly listed or inherent to those processes, methods, products, or apparatuses.
[0079] To improve the efficiency and accuracy of focus movement, this application provides a focus movement method for a user interface. The focus movement method for a user interface provided in this application will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0080] Please see the appendix Figure 1 , Figure 1 This is a flowchart illustrating a user interface focus movement method provided in an embodiment of this application. The method may include the following steps:
[0081] Step S101: Determine multiple interface elements of the user interface, including the current focus and the target focus.
[0082] It's important to note that in user interface design, interface elements refer to the various components that make up the user interface, such as buttons, text boxes, lists, images, videos, and menus. These elements provide users with ways to interact with the software or application. The current focus refers to the interface element the user is currently interacting with, which is usually indicated by visual cues (such as highlighting, color changes, or bold borders). The current focus is the interface element the user is interacting with. The target focus is the interface element the user wants to interact with.
[0083] In this application, the user interface can first be obtained using methods such as Appium, UI Automator, and uiautomator dump. For details, please refer to [reference needed]. Figure 2 and Figure 3 , Figure 2 This is a schematic diagram of a user interface disclosed in an embodiment of this application. Taking Appium as an example, the user interface can be obtained through the framework's built-in get_source method or the built-in adb service. The command is: adb shell uiautomator dump / data / local / tmp / dump.xml; Figure 3This is a schematic diagram of the layout information of a user interface disclosed in an embodiment of this application. The data format of the layout information of the user interface is XML.
[0084] Then use the XPath syntax ". / / The `[@focusable="true"][@clickable="true"]` directive and the `findall` method from Python's `xml.etree` module identify all clickable and focusable UI elements. The `Focusable` and `clickable` attributes represent whether the element is focusable and clickable, respectively. Focus can only be applied to UI elements; other UI elements are only for display. See [link / reference] for more details. Figure 4 , Figure 4 This is a schematic diagram of multiple interface elements of a user interface disclosed in an embodiment of this application, with a total of 26 interface elements e1-e26 in the figure.
[0085] Finally, the current focus can be obtained using the XPath syntax ". / / *[@focusable="true"][@focused="true"]" and the find method of the xml.etree module. The Focused attribute indicates that the focus is on this element.
[0086] At this point, it can also be determined whether the current focus and the target focus are the same focus, that is, whether the coordinates of the current focus and the target focus are consistent. If they are consistent, the current process ends; if they are inconsistent, the area is divided based on the interface elements.
[0087] Step S102: Treat each interface element as a child element, reverse the lookup of the parent element of each child element, and divide the child elements belonging to the same parent element into the same initial area.
[0088] In this application, each interface element can be treated as a child element. The child elements are traversed by a FOR loop. The layout characteristics of the interface elements are analyzed as needed (usually involving the arrangement, spacing, size, etc. of the interface elements). The parent element of each child element is obtained by reverse lookup using the iter method of the xml.etree module. If the parent elements are the same, they can be divided into the same initial area.
[0089] For better understanding, please refer to the following details. Figure 5 and Figure 6 . Figure 5 This is a schematic diagram of a user interface and its layout information disclosed in an embodiment of this application. The area shown in number 1 in the user interface contains 5 sub-elements, and number 2 is the layout information of the area shown in number 1. Figure 6This is a schematic diagram of an initial region disclosed in an embodiment of this application. The diagram shows six initial regions, from area1 to area6, where area3 contains... Figure 5 The area indicated by index 1 contains 5 child elements, that is, area3 contains... Figure 4 e1-e26 in the series.
[0090] Step S103: For each initial region, based on the information of the sub-elements included in the obtained initial region, the initial region is divided to obtain multiple final regions.
[0091] In this application, for each initial region, since the focus movement within the preset irregular region is irregular, it is necessary to re-divide the preset irregular region within the initial region based on the information of the sub-elements included in the initial region to obtain multiple intermediate regions. When there are preset overlapping areas between the intermediate regions, it may be difficult to distinguish between the movement process between regions and the movement process within regions, reducing the usability of the user interface. Therefore, it is necessary to shrink the intermediate regions based on the information of the sub-elements included in the intermediate regions to obtain multiple final regions.
[0092] For better understanding, please refer to the following details. Figure 7 and Figure 8 . Figure 7 This is a schematic diagram of an intermediate region disclosed in an embodiment of this application. In the diagram, the preset irregular region area3 has been re-divided to obtain the divided area3 and area7. Figure 8 This is a schematic diagram of a final region disclosed in an embodiment of this application. In the diagram, the intermediate regions area1-area7 that intersect are all reduced to obtain the reduced area1-area7.
[0093] Step S104: Determine whether the current final region and the target final region are the same final region. The current final region is the final region where the current focus is located, and the target final region is the final region where the target focus is located.
[0094] In this application, it can be determined whether the current final region and the target final region are the same final region by judging whether the coordinates of the current final region and the target final region are exactly the same, and then it can be determined whether the current focus needs to move between regions or within the region.
[0095] Specifically, if the coordinates of the current final region and the target final region are exactly the same, it means that the current final region and the target final region are the same final region, and the current focus is moved directly within the region; if the coordinates of the current final region and the target final region are not exactly the same, it means that the current final region and the target final region are not the same final region, and the current focus is first moved between regions, and then moved within the region.
[0096] If the current final region and the target final region are not the same final region, then proceed to step S105.
[0097] Step S105: Based on the coordinates of the current final region and the target final region, determine the movement direction between regions. According to the movement direction between regions, move the current focus from the current final region to the adjacent final region of the current final region, update the current final region to the adjacent final region, and return to execute the step of determining whether the current final region and the target final region are the same final region, until the current final region and the target final region are the same final region.
[0098] In this application, the inter-region movement of the current focus can first calculate the relative position between the current final region and the target final region, and preferentially select the direction with greater distance to determine the optional inter-region movement direction, and then determine the inter-region movement direction. Then, according to the inter-region movement direction, the current focus is moved from the current final region to the adjacent final region of the current final region, and the step of determining whether the current final region and the target final region are the same final region is executed, until the current final region and the target final region are the same final region, that is, the coordinates of the current final region and the coordinates of the target final region are exactly the same.
[0099] Step S106: Based on the coordinates of the current focus and the target focus, calculate the movement direction and movement distance within the region, and move the current focus to the target focus according to the movement direction and movement distance within the region.
[0100] It should be noted that the coordinates of the current focus include the x-coordinate and y-coordinate of the current focus, the coordinates of the target focus include the x-coordinate and y-coordinate of the target focus, the movement direction within the area includes the horizontal movement direction within the area and the vertical movement direction within the area, and the movement distance within the area includes the horizontal movement distance within the area and the vertical movement distance within the area.
[0101] In this application, after the current final area and the target final area are the same final area, the current focus is moved within the area. Based on the calculated movement direction and movement distance within the area, the remote control sends a button, triggering an event or command corresponding to a button on the physical remote control, and moving the current focus to the target focus.
[0102] Movement within the current focus area can be achieved by first comparing the x-coordinate of the current focus with that of the target focus to calculate the horizontal movement direction within the area, and then calculating the horizontal movement distance within the area based on the absolute value of the difference between the x-coordinates of the current focus and the target focus. Next, by comparing the y-coordinates of the current focus and the target focus, the vertical movement direction within the area can be calculated, and then the vertical movement distance within the area can be calculated based on the absolute value of the difference between the y-coordinates of the current focus and the target focus. Finally, the current focus can be moved to the target focus according to the horizontal movement direction, the horizontal movement distance within the area, the vertical movement direction within the area, and the vertical movement distance within the area.
[0103] Specifically, if the x-coordinate of the current focus is less than the x-coordinate of the target focus, then the current focus is considered to be to the left of the target focus, and the horizontal movement direction between regions is to the right; otherwise, the horizontal movement direction within the region is to the left. If the y-coordinate of the current focus is less than the y-coordinate of the target focus, then the current focus is considered to be above the target focus, and the vertical movement direction between regions is down; otherwise, the horizontal movement direction within the region is up.
[0104] For easier understanding, please refer to [the following]. Figure 9 , Figure 9 This is a schematic diagram of another user interface provided in an embodiment of this application. The full keyboard input in the figure is a typical final area, which contains a 6-row, 6-column two-dimensional list grid layout [[A,B,C,D,E,F],[G,H,I,J,K,L]...[Y,Z,1,2,3,4],[5,6,7,8,9,0]]. A position dictionary {'A':(0,0),'B':(0,1)...'F':(0,5),'G':(1,0),'H':(1,1)...'9':(5,4),'0':(5,5),} can be generated based on the two-dimensional list. The current focus is ('A':(0,0)), and the target focus is (0':(5,5)). According to the calculation, the horizontal movement direction within the area is right, the horizontal movement distance within the area is 5, the vertical movement direction within the area is down, and the vertical movement distance within the area is 5.
[0105] In summary, the focus movement method for a user interface provided in this application first determines multiple interface elements, including the current focus and the target focus. The user interface is divided into initial regions using these interface elements, and then further divided into final regions based on the information from these elements. This method is independent of the specific layout of the user interface and can automatically divide different user interfaces into regions. First, the current focus is moved between regions until the current final region and the target final region are in the same final region. This process involves moving the focus between regions, eliminating the need to navigate through each individual interface element, reducing unnecessary movement steps, and improving focus movement efficiency. Then, the current focus is moved within the same region until it reaches the target focus. When the current and target focuses are in the same final region, precise focus movement is achieved based on the focus's coordinates, ensuring accurate focus movement.
[0106] Furthermore, based on the above method, the following steps may also be included:
[0107] Step S107: Determine whether the coordinates of the current focus are the same as the coordinates of the target focus.
[0108] In this application, it can be determined whether the current focus has successfully moved to the target focus by judging whether the coordinates of the current focus are the same as the coordinates of the target focus. If the coordinates of the current focus are the same as the coordinates of the target focus, it is determined that the current focus has successfully moved to the target focus; if the coordinates of the current focus are not the same as the coordinates of the target focus, it is determined that the current focus has not successfully moved to the target focus.
[0109] If the coordinates of the current focus are different from the coordinates of the target focus, then return to step S104.
[0110] In this application, if the coordinates of the current focus are not the same as the coordinates of the target focus, it is determined that the current focus has not successfully moved to the target focus. Therefore, it is necessary to return to the previous steps and determine whether the current final region and the target final region are the same final region. If the current final region and the target final region are the same final region, then only intra-region movement of the current focus is required; if the current final region and the target final region are not the same final region, then inter-region movement of the current focus is required first, followed by intra-region movement.
[0111] If the coordinates of the current focus are different from the coordinates of the target focus, then return to step S108.
[0112] Step S108: End the process.
[0113] In summary, the introduction of these two new steps makes the focus movement logic more complete and efficient. By directly comparing the coordinates of the current focus with the coordinates of the target focus, it can be quickly determined whether the current focus has successfully moved to the target focus. If the movement fails, a retry mechanism can be triggered in a timely manner, enabling rapid identification of the problem and implementation of corresponding solutions, ensuring the accuracy of focus movement and improving the user experience.
[0114] One possible implementation details a specific method for dividing the initial region into multiple final regions based on information about the sub-elements included in the acquired initial region.
[0115] As one possible implementation method, please refer to the appendix. Figure 10 This is a schematic diagram illustrating a method for dividing an initial region into multiple final regions based on information about the sub-elements included in the initial region, as provided in this application. The method may include the following steps:
[0116] Step S201: Based on the coordinates of each sub-element included in the initial region and the total number of sub-elements included in the initial region, determine whether the initial region is a preset irregular region.
[0117] It should be noted that the information of the sub-elements included in the initial region includes: the coordinates of each sub-element and the total number of sub-elements. Specifically, the coordinates of each sub-element include the maximum x-coordinate, the minimum x-coordinate, the maximum y-coordinate, and the minimum y-coordinate of each sub-element.
[0118] In this application, the center x-coordinate and center y-coordinate of each sub-element included in the initial region can be calculated first based on the maximum x-coordinate, the minimum x-coordinate, the maximum y-coordinate, and the minimum x-coordinate of each sub-element included in the initial region.
[0119] Specifically, the sum of the largest and smallest x-coordinates of all sub-elements within the initial region is divided by two to calculate the center x-coordinate of each sub-element. Similarly, the sum of the largest and smallest x-coordinates of all sub-elements within the initial region is divided by two to calculate the center y-coordinate of each sub-element. For easier understanding, please refer to... Figure 11 , Figure 11This is a schematic diagram of the coordinates of a sub-element disclosed in an embodiment of this application. The positive direction of the X-axis is to the right, the positive direction of the Y-axis is down, and the positions of the maximum x-coordinate, maximum y-coordinate, minimum x-coordinate, minimum y-coordinate, center x-coordinate, and center y-coordinate of the sub-element are indicated.
[0120] Then, the child elements with the same center x-coordinate included in the initial region are identified as a child element row, and the number of child element rows is obtained; the child elements with the same center y-coordinate included in the initial region are identified as a child element column, and the number of child element columns is obtained; it is then determined whether the product of the number of child element rows minus 1 and the number of child element columns is greater than the total number of child elements included in the initial region.
[0121] To facilitate understanding, consider the following example: If the x-coordinate of the center of child element A in the initial region is the same as the x-coordinate of the center of child element B in the initial region, it means that child element A and child element B in the initial region are in the same child element row. By accumulating the child element rows, we can obtain the number of child element rows. If the y-coordinate of the center of child element A in the initial region is the same as the y-coordinate of the center of child element B in the initial region, it means that child element A and child element B in the initial region are in the same child element column. By accumulating the child element columns, we can obtain the number of child element columns.
[0122] If the product of the number of rows of child elements minus 1 and the number of columns of child elements is greater than the total number of child elements included in the initial region, then the initial region is determined to be a preset irregular region.
[0123] For better understanding, please refer to the following details. Figure 5 . Figure 5 The region shown in index 1 contains 5 child elements, with 3 rows and 3 columns. The product of the number of child elements (minus 1) and the number of child elements (number of columns) is 6. This product is greater than the total number of child elements in the initial region. Therefore, Figure 5 The area shown in number 1 is a pre-defined irregular area.
[0124] If the product of the number of child element rows minus 1 and the number of child element columns is not greater than the total number of child elements included in the initial region, then it is determined whether the initial region satisfies the first preset condition. The first preset condition is that the minimum value of the center ordinate of each child element included in the initial region in each child element row is the same, or the minimum value of the center abscissa of each child element included in the initial region in each child element column is the same.
[0125] If the initial region does not meet the first preset condition, then the initial region is determined to be a preset irregular region; if the initial region meets the first preset condition, then the initial region is determined not to be a preset irregular region.
[0126] If the initial region is a preset irregular region, then step S202 is executed.
[0127] Step S202: Divide the initial region based on the coordinates of each sub-element included in the initial region to obtain at least one intermediate region.
[0128] In this application, by traversing the center x-coordinate and center y-coordinate of each child element included in the initial region, child elements included in the initial region whose minimum center y-coordinate values in each row of child elements are the same are divided into the same intermediate region; otherwise, they are divided into another region. Alternatively, child elements included in the initial region whose minimum center x-coordinate values in each column of child elements are the same are divided into the same intermediate region; otherwise, they are divided into another region.
[0129] Step S203: Take each intermediate region as the current intermediate region: Based on the coordinates of each child element included in the current intermediate region and the coordinates of each child element included in other intermediate regions, determine whether the current intermediate region is a preset intersection region, and other intermediate regions are intermediate regions other than the current intermediate region.
[0130] It should be noted that the preset intersection area refers to the intermediate area that overlaps or intersects with other intermediate areas in space.
[0131] In this application, it is determined whether the coordinates of at least one child element included in the current intermediate region are the same as the coordinates of at least one child element included in other intermediate regions. If the coordinates of at least one child element included in the current intermediate region are the same as the coordinates of at least one child element included in other intermediate regions, then the current intermediate region is determined to be a preset intersection region; if the coordinates of each child element included in the current intermediate region are not the same as the coordinates of each child element included in other intermediate regions, then the current intermediate region is determined not to be a preset intersection region.
[0132] If the current middle area is a preset intersection area, then step S204 is executed.
[0133] Step S204: Divide the current intermediate region based on the coordinates of each sub-element included in the current intermediate region to obtain the final region.
[0134] It should be noted that the coordinates of each child element included in the current middle area include the maximum x-coordinate, the minimum x-coordinate, the maximum y-coordinate, and the minimum y-coordinate of each child element included in the current middle area.
[0135] In this application, the maximum x-coordinate, minimum x-coordinate, maximum y-coordinate, and minimum y-coordinate of the current intermediate region can be determined first from the maximum x-coordinate, minimum x-coordinate, maximum y-coordinate, and minimum y-coordinate of each sub-element included in the current intermediate region. Then, based on these coordinates, the current intermediate region is divided to obtain the final region.
[0136] Specifically, the maximum x-coordinate of all sub-elements included in the current intermediate region is determined as the maximum x-coordinate of the current intermediate region; the minimum x-coordinate of all sub-elements included in the current intermediate region is determined as the minimum x-coordinate of the current intermediate region; the maximum y-coordinate of all sub-elements included in the current intermediate region is determined as the maximum y-coordinate of the current intermediate region; and the minimum y-coordinate of all sub-elements included in the current intermediate region is determined as the minimum y-coordinate of the current intermediate region. The maximum x-coordinate of the current intermediate region is then used as the maximum x-coordinate of the final region; the minimum x-coordinate of the current intermediate region is then used as the minimum x-coordinate of the final region; and the maximum y-coordinate of the current intermediate region is then used as the maximum y-coordinate of the final region; and the minimum y-coordinate of the current intermediate region is then used as the minimum y-coordinate of the final region.
[0137] In summary, this application provides a method for dividing an initial region into multiple final regions based on information about the sub-elements included in the acquired initial region. First, by determining the irregularity of the initial region and dividing the pre-defined irregular region into intermediate regions, irrational focus movement within the pre-defined irregular region can be avoided. Then, by determining the intersection of the intermediate regions and further dividing the intersection regions, it can be ensured that the obtained final regions are accurate, independent, and suitable for subsequent operations. This fine-grained region division can significantly improve the accuracy and efficiency of focus movement, providing users with a better user experience.
[0138] In one possible implementation, a detailed description is provided of the specific method for determining the direction of movement between regions based on the coordinates of the current final region and the coordinates of the target final region.
[0139] As one possible implementation method, please refer to the appendix. Figure 12 This is a schematic diagram illustrating a method for determining the direction of movement between regions based on the coordinates of the current final region and the coordinates of the target final region, as provided in this application. The method may include the following steps:
[0140] Step S301: Based on the maximum and minimum x-coordinates of the current final region, calculate the center x-coordinate of the current final region, and based on the maximum and minimum x-coordinates of the target final region, calculate the center x-coordinate of the target final region.
[0141] It should be noted that the coordinates of the current final region include the maximum and minimum x-coordinates of the current final region, while the coordinates of the target final region include the maximum and minimum x-coordinates of the target final region.
[0142] In this application, the center abscissa of the current final region can be calculated by dividing the sum of the maximum abscissa of the current final region and the minimum abscissa of the current final region by two; the center abscissa of the target final region can be calculated by dividing the sum of the maximum abscissa of the target final region and the minimum abscissa of the target final region by two.
[0143] Step S302: Based on the center x-coordinate of the current final region and the center x-coordinate of the target final region, calculate the horizontal movement direction and horizontal movement distance between regions.
[0144] In this application, by comparing the center x-coordinate of the current final region with the center x-coordinate of the target final region, the current final region can move left or right to reach the target final region, i.e., the horizontal movement direction between regions. The horizontal movement distance between the current final region and the target final region can be obtained by calculating the absolute value of the difference between the center x-coordinate of the current final region and the center x-coordinate of the target final region, i.e., the horizontal movement distance between regions.
[0145] Specifically, if the x-coordinate of the center of the current final region is less than the x-coordinate of the center of the target final region, then the current final region is considered to be to the left of the current final region. The current final region can move to the right to reach the target final region. The horizontal movement direction between regions is to the right, and vice versa.
[0146] Step S303: Based on the maximum and minimum ordinates of the current final region, calculate the center ordinate of the current final region, and based on the maximum and minimum ordinates of the target final region, calculate the center ordinate of the target final region.
[0147] It should be noted that the coordinates of the current final region include the maximum and minimum ordinates of the current final region; the coordinates of the target final region include the maximum and minimum ordinates of the target final region.
[0148] In this application, the center coordinate of the current final region can be calculated by dividing the sum of the maximum and minimum ordinates of the current final region by two; the center coordinate of the target final region can also be calculated by dividing the sum of the maximum and minimum ordinates of the target final region by two.
[0149] Step S304: Based on the center ordinate of the current final region and the center ordinate of the target final region, calculate the vertical movement direction and vertical movement distance between regions.
[0150] In this application, by comparing the center ordinate of the current final region with the center ordinate of the target final region, the current final region can move upwards or downwards to reach the target final region, i.e., the vertical movement direction between regions. The vertical movement distance between the current final region and the target final region can be obtained by calculating the absolute value of the difference between the center ordinate of the current final region and the center ordinate of the target final region, i.e., the vertical movement distance between regions.
[0151] Specifically, if the center ordinate of the current final region is less than the center ordinate of the target final region, then the current final region is considered to be above the target final region. The current final region can move downwards to reach the target final region. The horizontal movement direction between regions is downwards, and vice versa.
[0152] Step S305: Compare the horizontal movement distance and the vertical movement distance between regions to determine the optional movement direction between regions. Based on the optional movement direction between regions, determine the movement direction between regions. The optional movement direction between regions is one of the horizontal movement direction between regions and the vertical movement direction between regions.
[0153] In this application, the horizontal movement distance between regions and the vertical movement distance between regions can be compared. If the horizontal movement distance between regions is greater, the selectable direction of movement between regions is determined to be the horizontal movement direction; if the vertical movement distance between regions is greater, the selectable direction of movement between regions is determined to be the vertical movement direction.
[0154] For better understanding, please refer to the following details. Figure 13 . Figure 13Another schematic diagram of the final area disclosed in the embodiments of the present application. In the figure, area2 is the current final area, area6 is the target final area, the abscissa of the center of area2 < the abscissa of the center of area6, and the horizontal movement direction between areas is to the right. The ordinate of the center of area2 > the ordinate of the center of area6, and the horizontal movement direction between areas is upward. Compare the horizontal movement distance between areas and the vertical movement distance between areas. If the horizontal movement distance between areas is farther, then determine that the optional movement direction between areas is the horizontal movement direction between areas.
[0155] However, it may be impossible to move because there is no intersecting area in the optional movement direction between areas for the current final area, resulting in the current final area being unable to move to the target final area. Therefore, it is necessary to determine the movement direction between areas based on the optional movement direction between areas.
[0156] If the optional movement direction between areas is the horizontal movement direction between areas, determine whether there is an optional adjacent final area of the current final area. The relationship between the coordinates of the current final area and the coordinates of the optional adjacent final area satisfies the second preset condition. The second preset condition is used to indicate the first relationship, the second relationship, and the third relationship. The first relationship is the relationship between the maximum ordinate of the current final area and the minimum ordinate of the optional adjacent final area. The second relationship is the relationship between the minimum ordinate of the current final area and the maximum ordinate of the optional adjacent final area. The third relationship is the relationship between the abscissa of the center of the current final area and the calculated abscissa of the center of the optional adjacent final area. If it is satisfied, then determine that the movement direction between areas is the horizontal movement direction between areas. If it is not satisfied, then determine that the movement direction between areas is the vertical movement direction between areas.
[0157] It should be noted that the coordinates of the optional adjacent final area include the maximum abscissa of the optional adjacent final area and the minimum abscissa of the optional adjacent final area.
[0158] In the present application, divide the sum of the maximum abscissa of the optional adjacent final area and the minimum abscissa of the optional adjacent final area by two to calculate the relationship between the abscissas of the centers of the optional adjacent final areas.
[0159] For the sake of easy understanding, the following is an example:
[0160] Taking the horizontal movement direction between areas being to the left as an example: The first relationship is that the maximum ordinate of the current final area ≥ the minimum ordinate of the optional adjacent final area; the second relationship is that the minimum ordinate of the current final area ≤ the maximum ordinate of the optional adjacent final area, and the third relationship is that the abscissa of the center of the current final area > the abscissa of the center of the optional adjacent final area.
[0161] Taking the horizontal movement direction between regions as right as an example: the first relationship is that the maximum ordinate of the current final region is greater than or equal to the minimum ordinate of the optional adjacent final regions; the second relationship is that the minimum ordinate of the current final region is less than or equal to the maximum ordinate of the optional adjacent final regions; and the third relationship is that the center abscissa of the current final region is less than or equal to the center abscissa of the optional adjacent final regions.
[0162] If the movement direction between selectable regions is a vertical movement direction, determine whether there exists a selectable adjacent final region for the current final region. The relationship between the coordinates of the current final region and the coordinates of the selectable adjacent final regions satisfies the third preset condition. The third preset condition is used to indicate the fourth, fifth, and sixth relationships. The fourth relationship is the relationship between the maximum x-coordinate of the current final region and the minimum x-coordinate of the selectable adjacent final region. The fifth relationship is the relationship between the minimum x-coordinate of the current final region and the maximum x-coordinate of the selectable adjacent final region. The sixth relationship is the relationship between the center y-coordinate of the current final region and the calculated center y-coordinate of the selectable adjacent final region. If the conditions are met, the movement direction between regions is determined to be a vertical movement direction. If the conditions are not met, the movement direction between regions is determined to be a horizontal movement direction.
[0163] It should be noted that the coordinates of the optional adjacent final regions include the maximum ordinate of the optional adjacent final regions and the minimum ordinate of the optional adjacent final regions.
[0164] In this application, the relationship between the center coordinates of the optional adjacent final regions is calculated by dividing the sum of the maximum and minimum ordinates of the optional adjacent final regions by two.
[0165] To make it easier to understand, the following example is provided:
[0166] Taking the horizontal movement direction between regions as an example: the fourth relationship is that the maximum horizontal coordinate of the current final region is greater than or equal to the minimum horizontal coordinate of the optional adjacent final region; the fifth relationship is that the minimum horizontal coordinate of the current final region is less than or equal to the minimum horizontal coordinate of the optional adjacent final region; and the sixth relationship is that the center vertical coordinate of the current final region is greater than the center vertical coordinate of the optional adjacent final region.
[0167] Taking the horizontal movement direction between regions as an example: the fourth relationship is that the maximum x-coordinate of the current final region is greater than or equal to the minimum x-coordinate of the optional adjacent final region; the fifth relationship is that the minimum x-coordinate of the current final region is less than or equal to the minimum x-coordinate of the optional adjacent final region; and the sixth relationship is that the center y-coordinate of the current final region is less than or equal to the center y-coordinate of the optional adjacent final region.
[0168] The above describes a user interface focus movement method provided by the embodiments of this application. The following will describe the apparatus for performing the above user interface focus movement method.
[0169] Please see Figure 14 , Figure 14 This is a schematic diagram of the structure of a focus-moving device for a user interface provided in an embodiment of this application. Figure 14 As shown, the focus movement device of this user interface includes:
[0170] The determining unit 11 is used to determine multiple interface elements of the user interface, including the current focus and the target focus.
[0171] The first division unit 12 is used to treat each of the interface elements as child elements, reverse look up the parent element of each child element, and divide the child elements belonging to the same parent element into the same initial area.
[0172] The second division unit 13 is used to divide the initial region based on the information of the sub-elements included in the initial region to obtain multiple final regions.
[0173] The judgment unit 14 is used to determine whether the current final region and the target final region are the same final region, wherein the current final region is the final region where the current focus is located, and the target final region is the final region where the target focus is located.
[0174] The first moving unit 15 is configured to, if the current final region and the target final region are not the same final region, determine the inter-region moving direction based on the obtained coordinates of the current final region and the target final region, move the current focus from the current final region to the adjacent final region of the current final region according to the inter-region moving direction, update the current final region to the adjacent final region, and return to execute the step of determining whether the current final region and the target final region are the same final region, until the current final region and the target final region are the same final region.
[0175] The second moving unit 16 is used to calculate the moving direction and moving distance within the region based on the obtained coordinates of the current focus and the target focus, and to move the current focus to the target focus according to the moving direction and moving distance within the region.
[0176] In one possible implementation, the information of the sub-elements included in the initial region includes: the coordinates of each sub-element included in the initial region and the total number of sub-elements included in the initial region;
[0177] The second dividing unit 13 includes:
[0178] The first judgment subunit is used to determine whether the initial region is a preset irregular region based on the coordinates of each sub-element included in the initial region and the total number of sub-elements included in the initial region.
[0179] The first dividing subunit is used to divide the initial region based on the coordinates of each sub-element included in the initial region if the initial region is the preset irregular region, thereby obtaining at least one intermediate region.
[0180] The second judgment subunit is used to take each of the intermediate regions as the current intermediate region: based on the coordinates of each sub-element included in the current intermediate region and the coordinates of each sub-element included in other intermediate regions, it determines whether the current intermediate region is a preset intersection region, and the other intermediate regions are intermediate regions other than the current intermediate region.
[0181] The second dividing subunit is used to divide the current intermediate region based on the coordinates of each sub-element included in the current intermediate region if the current intermediate region is the preset intersection region, so as to obtain the final region.
[0182] In one possible implementation, the coordinates of each sub-element included in the initial region include the maximum x-coordinate of each sub-element included in the initial region, the minimum x-coordinate of each sub-element included in the initial region, the maximum y-coordinate of each sub-element included in the initial region, and the minimum y-coordinate of each sub-element included in the initial region.
[0183] The first determination subunit includes:
[0184] The first calculation subunit is used to calculate the center x-coordinate and center y-coordinate of each sub-element included in the initial region based on the maximum x-coordinate, the minimum x-coordinate, the maximum y-coordinate, and the minimum x-coordinate of each sub-element included in the initial region.
[0185] The first sub-unit is used to determine the sub-elements with the same center x-coordinate in the initial region as a sub-element row, thereby obtaining the number of sub-element rows.
[0186] The second sub-unit is used to determine the sub-elements with the same center ordinate in the initial region as a sub-element column, thereby obtaining the number of sub-element columns.
[0187] The third judgment subunit is used to determine whether the product of the number of rows of the sub-element minus 1 and the number of columns of the sub-element is greater than the total number of sub-elements included in the initial region.
[0188] The first determining sub-unit is used to determine the initial region as the preset irregular region if the product of the number of rows of the sub-element minus 1 and the number of columns of the sub-element is greater than the total number of sub-elements included in the initial region.
[0189] The fourth judgment subunit is used to determine whether the initial region satisfies a first preset condition if the product of the number of sub-rows minus 1 and the number of sub-columns is not greater than the total number of sub-elements included in the initial region. The first preset condition is that the minimum value of the center ordinate of each sub-element included in the initial region in each sub-row is the same, or the minimum value of the center abscissa of each sub-element included in the initial region in each sub-column is the same.
[0190] The second determining subunit is used to determine the initial region as the preset irregular region if the initial region does not meet the first preset condition.
[0191] In one possible implementation, the second judgment subunit includes:
[0192] The fifth judgment subunit is used to determine whether the coordinates of at least one sub-element included in the current intermediate region are the same as the coordinates of at least one sub-element included in other intermediate regions.
[0193] The third determining sub-unit is used to determine the current intermediate region as the preset intersection region if the coordinates of at least one sub-element included in the current intermediate region are the same as the coordinates of at least one sub-element included in the other intermediate regions.
[0194] In one possible implementation, the coordinates of each sub-element included in the current intermediate region include the maximum x-coordinate of each sub-element included in the current intermediate region, the minimum x-coordinate of each sub-element included in the current intermediate region, the maximum y-coordinate of each sub-element included in the current intermediate region, and the minimum y-coordinate of each sub-element included in the current intermediate region.
[0195] The second sub-unit includes:
[0196] The fourth determining sub-unit is used to determine the maximum horizontal coordinate, minimum horizontal coordinate, maximum vertical coordinate, and minimum vertical coordinate of the current intermediate region from the maximum horizontal coordinate, minimum horizontal coordinate, maximum vertical coordinate, and minimum vertical coordinate of each sub-element included in the current intermediate region, respectively.
[0197] The third division subunit is used to divide the current intermediate region according to the maximum horizontal coordinate, the minimum horizontal coordinate, the maximum vertical coordinate, and the minimum vertical coordinate of the current intermediate region to obtain the final region.
[0198] In one possible implementation, the coordinates of the current final region include the maximum x-coordinate, the minimum x-coordinate, the maximum y-coordinate, and the minimum y-coordinate of the current final region, and the coordinates of the target final region include the maximum x-coordinate, the minimum x-coordinate, the maximum y-coordinate, and the minimum y-coordinate of the target final region;
[0199] The first moving unit 15, which determines the direction of movement between regions based on the acquired coordinates of the current final region and the target final region, includes:
[0200] The second calculation subunit is used to calculate the center abscissa of the current final region based on the maximum abscissa of the current final region and the minimum abscissa of the current final region, and to calculate the center abscissa of the target final region based on the maximum abscissa of the target final region and the minimum abscissa of the target final region.
[0201] The third calculation subunit is used to calculate the horizontal movement direction and horizontal movement distance between regions based on the center abscissa of the current final region and the center abscissa of the target final region.
[0202] The fourth calculation subunit is used to calculate the center ordinate of the current final region based on the maximum ordinate of the current final region and the minimum ordinate of the current final region, and to calculate the center ordinate of the target final region based on the maximum ordinate of the target final region and the minimum ordinate of the target final region.
[0203] The fifth calculation subunit is used to calculate the vertical movement direction and vertical movement distance between regions based on the center ordinate of the current final region and the center ordinate of the target final region.
[0204] The fifth determining subunit is used to compare the horizontal movement distance between the regions and the vertical movement distance between the regions, determine the optional movement direction between the regions, and determine the movement direction between the regions based on the optional movement direction between the regions. The optional movement direction between the regions is one of the horizontal movement direction between the regions and the vertical movement direction between the regions.
[0205] In one possible implementation, the coordinates of the optional adjacent final region include the maximum x-coordinate of the optional adjacent final region, the minimum x-coordinate of the optional adjacent final region, the maximum y-coordinate of the optional adjacent final region, and the minimum y-coordinate of the optional adjacent final region.
[0206] The fifth determining sub-unit, which determines the inter-regional movement direction based on the selectable inter-regional movement direction, includes:
[0207] The sixth determining subunit is used to determine whether there is an optional adjacent final region for the current final region if the movement direction between the optional regions is the horizontal movement direction between the regions. The relationship between the coordinates of the current final region and the coordinates of the optional adjacent final region satisfies a second preset condition. The second preset condition is used to indicate a first relationship, a second relationship, and a third relationship. The first relationship is the relationship between the maximum ordinate of the current final region and the minimum ordinate of the optional adjacent final region. The second relationship is the relationship between the minimum ordinate of the current final region and the maximum ordinate of the optional adjacent final region. The third relationship is the relationship between the center abscissa of the current final region and the calculated center abscissa of the optional adjacent final region. If the condition is satisfied, the movement direction between the regions is determined to be the horizontal movement direction between the regions. If the condition is not satisfied, the movement direction between the regions is determined to be the vertical movement direction between the regions.
[0208] The seventh determining subunit is used to determine whether there is an optional adjacent final region for the current final region if the movement direction between the optional regions is the vertical movement direction between the regions. The relationship between the coordinates of the current final region and the coordinates of the optional adjacent final region satisfies a third preset condition. The third preset condition is used to indicate a fourth, fifth, and sixth relationship. The fourth relationship is the relationship between the maximum abscissa of the current final region and the minimum abscissa of the optional adjacent final region. The fifth relationship is the relationship between the minimum abscissa of the current final region and the maximum abscissa of the optional adjacent final region. The sixth relationship is the relationship between the center ordinate of the current final region and the calculated center ordinate of the optional adjacent final region. If the condition is satisfied, the movement direction between the regions is determined to be the vertical movement direction between the regions. If the condition is not satisfied, the movement direction between the regions is determined to be the horizontal movement direction between the regions.
[0209] In one possible implementation, the coordinates of the current focus include the x-coordinate and y-coordinate of the current focus, the coordinates of the target focus include the x-coordinate and y-coordinate of the target focus, the movement direction within the region includes the horizontal movement direction within the region and the vertical movement direction within the region, and the movement distance within the region includes the horizontal movement distance within the region and the vertical movement distance within the region.
[0210] Based on the obtained coordinates of the current focus and the target focus, a second moving unit 16 is calculated to determine the moving direction and moving distance within the region, including:
[0211] The sixth calculation subunit is used to calculate the horizontal movement direction and the horizontal movement distance within the region based on the horizontal coordinate of the current focus and the horizontal coordinate of the target focus.
[0212] The seventh calculation subunit is used to calculate the vertical movement direction and the vertical movement distance within the region based on the ordinate of the current focus and the ordinate of the target focus.
[0213] In one possible implementation, the device further includes:
[0214] The coordinate determination unit is used to determine whether the coordinates of the current focus are the same as the coordinates of the target focus.
[0215] The return unit is used to return to the step of determining whether the current final region and the target final region are the same final region if the coordinates of the current focus are not the same as the coordinates of the target focus.
[0216] It should also be noted that the device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. In addition, in the device embodiment drawings provided in this application, the connection relationship between modules indicates that they have a communication connection, which can be implemented as one or more communication buses or signal lines.
[0217] Through the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general-purpose hardware, or it can be implemented by special-purpose hardware including application-specific integrated circuits, special-purpose CPUs, special-purpose memory, special-purpose components, etc. Generally, any function performed by a computer program can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be diverse, such as analog circuits, digital circuits, or special-purpose circuits. However, for this application, software program implementation is more often the preferred implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a readable storage medium, such as a computer floppy disk, USB flash drive, mobile hard disk, ROM, RAM, magnetic disk, or optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, training equipment, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0218] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product.
[0219] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, training device, or data center to another website, computer, training device, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device or data center that integrates one or more available media. The available media may be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media (e.g., solid-state drives (SSDs)).
Claims
1. A method for focusing on a user interface, characterized in that, include: Determine multiple interface elements of the user interface, including the current focus and the target focus; Each of the interface elements is treated as a child element. The parent element of each child element is then looked up, and child elements belonging to the same parent element are assigned to the same initial area. For each initial region, the sub-elements with the same center x-coordinate included in the initial region are determined as a sub-element row, and the number of sub-element rows is obtained. The sub-elements with the same center y-coordinate included in the initial region are determined as a sub-element column, and the number of sub-element columns is obtained. Determine whether the product of the number of rows of the sub-element minus 1 and the number of columns of the sub-element is greater than the total number of sub-elements included in the initial region; If so, the initial region is determined to be a preset irregular region, and the initial region is divided based on the coordinates of each sub-element included in the initial region to obtain multiple final regions; Determine whether the current final region and the target final region are the same final region, wherein the current final region is the final region where the current focus is located, and the target final region is the final region where the target focus is located; If the current final region and the target final region are not the same final region, then based on the obtained coordinates of the current final region and the target final region, the movement direction between regions is determined. According to the movement direction between regions, the current focus is moved from the current final region to the adjacent final region of the current final region, and the current final region is updated to the adjacent final region. Then, the step of determining whether the current final region and the target final region are the same final region is returned to be executed until the current final region and the target final region are the same final region. Based on the obtained coordinates of the current focus and the target focus, the movement direction and movement distance within the region are calculated, and the current focus is moved to the target focus according to the movement direction and movement distance within the region.
2. The user interface focus movement method according to claim 1, characterized in that, The initial region is divided based on the coordinates of each sub-element included in the initial region to obtain multiple final regions, including: The initial region is divided based on the coordinates of each sub-element included in the initial region to obtain at least one intermediate region; Each of the intermediate regions is taken as the current intermediate region: based on the coordinates of each sub-element included in the current intermediate region and the coordinates of each sub-element included in other intermediate regions, it is determined whether the current intermediate region is a preset intersection region, and the other intermediate regions are intermediate regions other than the current intermediate region. If the current intermediate region is the preset intersection region, then the current intermediate region is divided based on the coordinates of each sub-element included in the current intermediate region to obtain the final region.
3. The user interface focus movement method according to claim 2, characterized in that, The coordinates of each sub-element included in the initial region include the maximum x-coordinate, the minimum x-coordinate, the maximum y-coordinate, and the minimum y-coordinate of each sub-element included in the initial region. The method further includes: Based on the maximum x-coordinate, minimum x-coordinate, maximum y-coordinate, and minimum x-coordinate of each sub-element included in the initial region, calculate the center x-coordinate and center y-coordinate of each sub-element included in the initial region. If the product of the number of sub-rows of the sub-element and the number of columns of the sub-element is not greater than the total number of sub-elements included in the initial region, then it is determined whether the initial region satisfies the first preset condition. The first preset condition is that the minimum value of the center ordinate of each sub-element included in the initial region in each sub-element row is the same, or the minimum value of the center abscissa of each sub-element included in the initial region in each sub-element column is the same. If the initial region does not meet the first preset condition, then the initial region is determined to be the preset irregular region.
4. The user interface focus movement method according to claim 2, characterized in that, The step of determining whether the current intermediate region is a preset intersection region based on the coordinates of each sub-element included in the current intermediate region and the coordinates of each sub-element included in other intermediate regions includes: Determine whether the coordinates of at least one child element included in the current intermediate region are the same as the coordinates of at least one child element included in other intermediate regions; If the coordinates of at least one child element included in the current intermediate region are the same as the coordinates of at least one child element included in other intermediate regions, then the current intermediate region is determined to be the preset intersection region.
5. The user interface focus movement method according to claim 2, characterized in that, The coordinates of each sub-element included in the current intermediate region include the maximum x-coordinate, the minimum x-coordinate, the maximum y-coordinate, and the minimum y-coordinate of each sub-element included in the current intermediate region. The step of dividing the current intermediate region based on the coordinates of each sub-element included in the current intermediate region to obtain the final region includes: The maximum x-coordinate, minimum x-coordinate, maximum y-coordinate, and minimum y-coordinate of the current intermediate region are determined from the maximum x-coordinate, minimum x-coordinate, maximum y-coordinate, and minimum y-coordinate of each sub-element included in the current intermediate region, respectively. The current intermediate region is divided according to its maximum x-coordinate, minimum x-coordinate, maximum y-coordinate, and minimum y-coordinate to obtain the final region.
6. The user interface focus movement method according to claim 1, characterized in that, The coordinates of the current final region include the maximum x-coordinate, the minimum x-coordinate, the maximum y-coordinate, and the minimum y-coordinate of the current final region; the coordinates of the target final region include the maximum x-coordinate, the minimum x-coordinate, the maximum y-coordinate, and the minimum y-coordinate of the target final region. Determining the direction of movement between regions based on the acquired coordinates of the current final region and the target final region includes: Based on the maximum and minimum x-coordinates of the current final region, the center x-coordinate of the current final region is calculated, and based on the maximum and minimum x-coordinates of the target final region, the center x-coordinate of the target final region is calculated. Based on the center x-coordinate of the current final region and the center x-coordinate of the target final region, the horizontal movement direction and horizontal movement distance between regions are calculated. Based on the maximum and minimum ordinates of the current final region, the center ordinate of the current final region is calculated, and based on the maximum and minimum ordinates of the target final region, the center ordinate of the target final region is calculated. Based on the center ordinate of the current final region and the center ordinate of the target final region, the vertical movement direction and vertical movement distance between regions are calculated. By comparing the horizontal movement distance between the regions and the vertical movement distance between the regions, a selectable movement direction between the regions is determined, and based on the selectable movement direction between the regions, the movement direction between the regions is determined. The selectable movement direction between the regions is one of the horizontal movement direction between the regions and the vertical movement direction between the regions.
7. The user interface focus movement method according to claim 6, characterized in that, The coordinates of the optional adjacent final regions include the maximum x-coordinate of the optional adjacent final regions, the minimum x-coordinate of the optional adjacent final regions, the maximum y-coordinate of the optional adjacent final regions, and the minimum y-coordinate of the optional adjacent final regions. Determining the inter-regional movement direction based on the selectable inter-regional movement direction includes: If the movement direction between the selectable regions is the horizontal movement direction between the regions, it is determined whether there is a selectable adjacent final region for the current final region. The relationship between the coordinates of the current final region and the coordinates of the selectable adjacent final region satisfies a second preset condition. The second preset condition is used to indicate a first relationship, a second relationship, and a third relationship. The first relationship is the relationship between the maximum ordinate of the current final region and the minimum ordinate of the selectable adjacent final region. The second relationship is the relationship between the minimum ordinate of the current final region and the maximum ordinate of the selectable adjacent final region. The third relationship is the relationship between the center abscissa of the current final region and the calculated center abscissa of the selectable adjacent final region. If the condition is satisfied, the movement direction between the regions is determined to be the horizontal movement direction between the regions. If the condition is not satisfied, the movement direction between the regions is determined to be the vertical movement direction between the regions. If the movement direction between the selectable regions is the vertical movement direction between the regions, it is determined whether there is an optional adjacent final region of the current final region. The relationship between the coordinates of the current final region and the coordinates of the optional adjacent final region satisfies a third preset condition. The third preset condition is used to indicate a fourth, fifth, and sixth relationship. The fourth relationship is the relationship between the maximum horizontal coordinate of the current final region and the minimum horizontal coordinate of the optional adjacent final region. The fifth relationship is the relationship between the minimum horizontal coordinate of the current final region and the maximum horizontal coordinate of the optional adjacent final region. The sixth relationship is the relationship between the center vertical coordinate of the current final region and the calculated center vertical coordinate of the optional adjacent final region. If the condition is satisfied, the movement direction between the regions is determined to be the vertical movement direction between the regions. If the condition is not satisfied, the movement direction between the regions is determined to be the horizontal movement direction between the regions.
8. The user interface focus movement method according to claim 1, characterized in that, The coordinates of the current focus include the x-coordinate and y-coordinate of the current focus; the coordinates of the target focus include the x-coordinate and y-coordinate of the target focus; the movement direction within the region includes the horizontal movement direction and the vertical movement direction within the region; and the movement distance within the region includes the horizontal movement distance and the vertical movement distance within the region. The calculation of the movement direction and movement distance within the region based on the obtained coordinates of the current focus and the target focus includes: Based on the x-coordinate of the current focus and the x-coordinate of the target focus, the horizontal movement direction and the horizontal movement distance within the region are calculated. Based on the ordinate of the current focus and the ordinate of the target focus, the vertical movement direction and the vertical movement distance within the region are calculated.
9. The user interface focus movement method according to claim 1, characterized in that, After calculating the movement direction and movement distance within the region based on the obtained coordinates of the current focus and the target focus, and moving the current focus to the target focus according to the movement direction and movement distance within the region, the method further includes: Determine whether the coordinates of the current focus are the same as the coordinates of the target focus; If the coordinates of the current focus are not the same as the coordinates of the target focus, then return to the previous step to determine whether the current final region and the target final region are the same final region.
10. A focus movement device for a user interface, characterized in that, include: A determining unit is used to determine multiple interface elements of the user interface, including the current focus and the target focus; The first division unit is used to treat each of the interface elements as child elements, reverse look up the parent element of each child element, and divide the child elements belonging to the same parent element into the same initial area. The second division unit is used to divide the initial region based on the coordinates of each sub-element included in the initial region to obtain multiple final regions. The judgment unit is used to determine whether the current final region and the target final region are the same final region, wherein the current final region is the final region where the current focus is located, and the target final region is the final region where the target focus is located; The first moving unit is configured to, if the current final region and the target final region are not the same final region, determine the inter-region moving direction based on the obtained coordinates of the current final region and the target final region, move the current focus from the current final region to the adjacent final region according to the inter-region moving direction, update the current final region to the adjacent final region, and return to execute the step of determining whether the current final region and the target final region are the same final region, until the current final region and the target final region are the same final region; The second moving unit is used to calculate the moving direction and moving distance within the region based on the obtained coordinates of the current focus and the target focus, and to move the current focus to the target focus according to the moving direction and the moving distance within the region; The second partitioning unit includes: The first judgment subunit is used to determine whether the initial region is a preset irregular region based on the coordinates of each sub-element included in the initial region and the total number of sub-elements included in the initial region. The first determination subunit includes: The first sub-unit is used to determine the sub-elements with the same center x-coordinate in the sub-elements included in the initial region as a sub-element row, and obtain the number of sub-element rows; The second obtaining sub-unit is used to select sub-elements whose center ordinates are the same within the initial region. Once an element is identified as a sub-element column, obtain the number of sub-element columns; The third judgment subunit is used to determine whether the product of the number of rows of the sub-element minus 1 and the number of columns of the sub-element is greater than the total number of sub-elements included in the initial region; The first determining sub-unit is used to determine the initial region as the preset irregular region if the product of the number of rows of the sub-element minus 1 and the number of columns of the sub-element is greater than the total number of sub-elements included in the initial region.