Cursor moving method and device, electronic equipment and computer readable storage medium
By distinguishing focus elements and non-focus elements in a TV browser and determining the cursor movement range and position according to navigation operations, the problem of cumbersome cursor movement operation is solved, and the cursor is quickly moved to the expected element, improving the user experience.
Patent Information
- Application Number
- CN202510295148.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-13
- Publication Date
- 2025-06-27
AI Technical Summary
When the cursor moves between multiple optional elements in a TV browser, it is cumbersome to operate, affecting the user experience.
By distinguishing between focus elements and non-focus elements in the page, monitoring navigation operations, determining the moving range of the cursor based on the current position and movement direction of the cursor, and determining the moving position of the cursor based on whether the range contains focus elements or non-focus elements.
It realizes the cursor to quickly move to the focus element, simplifying user operations and improving user experience.
Smart Images

Figure CN120215769A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the technical field of cursors, and particularly to a cursor movement method, apparatus, electronic device, and computer-readable storage medium. Background Art
[0002] There are multiple selectable elements in a TV browser. When a user operates, they mainly rely on the "up, down, left, and right" buttons of the remote control to control the cursor to move among multiple selectable elements. Since the up, down, left, and right buttons can only control the cursor to move "one grid" each time, it has the disadvantage of cumbersome operation, which affects the user experience. Summary of the Invention
[0003] The embodiments of the present application provide a cursor movement method, apparatus, electronic device, and computer-readable storage medium, which can quickly move the cursor to the focus element.
[0004] In a first aspect, the embodiments of the present application provide a cursor movement method, including:
[0005] Obtaining the focus element and non-focus elements of the current page;
[0006] When a navigation operation is monitored, determining the moving direction of the cursor;
[0007] Obtaining the current position of the cursor;
[0008] According to the moving direction and current position of the cursor, determining the moving range of the cursor; and
[0009] According to whether the focus element or the non-focus element is included in the moving range of the cursor, determining the moving position of the cursor.
[0010] In one embodiment, the determining the moving position of the cursor according to whether the focus element or the non-focus element is included in the moving range of the cursor includes:
[0011] When the focus element is included in the moving range of the cursor, moving the cursor to the position of the focus element.
[0012] In one embodiment, when multiple focus elements are included in the moving range of the cursor, the moving the cursor to the position of the focus element includes:
[0013] Obtaining the positions and sizes of the multiple focus elements in the moving range respectively;
[0014] Determine the first focus element that the cursor will contact when moving from the current position in the moving direction according to the positions and sizes of the multiple focus elements within the moving range.
[0015] Move the cursor to the position of the first focus element.
[0016] In one embodiment, the determining the moving position of the cursor according to whether the moving range of the cursor includes the focus element or the non - focus element includes:
[0017] When the moving range of the cursor does not include the focus element but includes the non - focus element, move the cursor to the position of the non - focus element.
[0018] In one embodiment, when the moving range of the cursor does not include the focus element but includes multiple non - focus elements, the moving the cursor to the position of the non - focus element includes:
[0019] Obtain the positions and sizes of the multiple non - focus elements within the moving range;
[0020] Determine the first non - focus element that the cursor will contact when moving from the current position in the moving direction according to the positions and sizes of the multiple non - focus elements within the moving range;
[0021] Move the cursor to the position of the first non - focus element.
[0022] In one embodiment, the determining the moving position of the cursor according to whether the moving range of the cursor includes the focus element or the non - focus element includes:
[0023] When the moving range of the cursor does not include the focus element and the non - focus element, keep the cursor stationary.
[0024] In one embodiment, the obtaining the focus element and non - focus element of the current page includes:
[0025] Obtain the Document Object Model (DOM) tree of the current page;
[0026] Parse and traverse the DOM tree of the current page to obtain the focus element and the non - focus element of the current page.
[0027] In a second aspect, an embodiment of the present application provides a cursor moving device, including:
[0028] An element obtaining module, configured to obtain a focus element and a non - focus element of the current page;
[0029] A direction determination module, configured to determine the moving direction of the cursor when a navigation operation is monitored;
[0030] A position acquisition module, configured to acquire the current position of the cursor;
[0031] A range determination module, configured to determine the moving range of the cursor according to the moving direction and the current position of the cursor; and
[0032] A position determination module, configured to determine the moving position of the cursor according to whether the focus element or the non - focus element is included in the moving range of the cursor.
[0033] In one embodiment, the position determination module includes:
[0034] A first moving unit, configured to move the cursor to the position of the focus element when the focus element is included in the moving range of the cursor.
[0035] In one embodiment, when multiple focus elements are included in the moving range of the cursor, the first moving unit includes:
[0036] A first acquisition subunit, configured to acquire the positions and sizes of the multiple focus elements in the moving range;
[0037] A first determination subunit, configured to determine the first focus element that the cursor will contact when moving from the current position in the moving direction according to the positions and sizes of the multiple focus elements in the moving range;
[0038] A first moving subunit, configured to move the cursor to the position of the first focus element.
[0039] In one embodiment, the position determination module includes:
[0040] A second moving unit, configured to move the cursor to the position of the non - focus element when the focus element is not included in the moving range of the cursor but the non - focus element is included.
[0041] In one embodiment, when the focus element is not included in the moving range of the cursor but multiple non - focus elements are included, the second moving unit includes:
[0042] A second acquisition subunit, configured to acquire the positions and sizes of the multiple non - focus elements in the moving range;
[0043] A second determination subunit, configured to determine, according to the positions and sizes of multiple non-focus elements within the moving range, the first non-focus element that the cursor will contact when moving from the current position in the moving direction.
[0044] A second moving subunit, configured to move the cursor to the position of the first non-focus element.
[0045] In one embodiment, the position determination module includes:
[0046] A stay still unit, configured to keep the cursor still when the moving range of the cursor does not include the focus element and the non-focus element.
[0047] In one embodiment, the element acquisition module includes:
[0048] A tree acquisition unit, configured to acquire the document object model (DOM) tree of the current page.
[0049] An analysis unit, configured to analyze and traverse the DOM tree of the current page to obtain the focus element and the non-focus element of the current page.
[0050] In a third aspect, an embodiment of the present application further provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, the steps in the above cursor movement method are implemented.
[0051] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above cursor movement method are implemented.
[0052] In a fifth aspect, an embodiment of the present application further provides a computer program product or a computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the methods provided in the various optional implementation manners of the embodiments of the present application.
[0053] In summary, in the embodiments of the present application, elements are divided into focus elements and non-focus elements. When a navigation operation is detected, the moving range of the cursor can be determined according to the current position of the cursor and the moving direction of the cursor, so as to determine the moving position of the cursor according to whether the moving range of the cursor includes focus elements or non-focus elements. In this way, focus elements and non-focus elements are distinguished, so the moving position of the cursor will be different in different situations, and thus it is possible to quickly move to the expected element and improve the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] In order to more clearly illustrate the technical solutions in the present application, the accompanying drawings required for the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention, and those skilled in the art can obtain other accompanying drawings without creative efforts based on these drawings.
[0055] Figure 1 is a schematic diagram of the steps of a cursor movement method provided by an embodiment of the present application;
[0056] Figure 2 is a schematic diagram of a TV browser page provided by an embodiment of the present application;
[0057] Figure 3 is a flowchart of a cursor movement method provided by an embodiment of the present application;
[0058] Figure 4 is a schematic structural diagram of a cursor movement device provided by an embodiment of the present application;
[0059] Figure 5 is a schematic structural diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0060] The technical solutions in the present application will be clearly and completely described below with reference to the accompanying drawings in the present application. Obviously, the described embodiments are only some embodiments of the present invention, rather than all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative efforts belong to the scope of protection of the present invention.
[0061] In one embodiment, as Figure 1As shown, a cursor movement method is provided. Although the logical order is shown in the step schematic diagram, in some cases, the steps shown or described can be executed in an order different from that shown in the drawings. Specifically, the cursor movement method can be applied to a terminal, where the terminal can include, but is not limited to, one or more of a smart TV, a gaming device, a tablet computer, a laptop computer, and a desktop computer. The page displayed on the screen of the terminal can have elements, and the cursor can be controlled to move in the page of the terminal through a remote control, a gamepad, etc.
[0062] The following will be described in detail respectively. It should be noted that the description order of the following embodiments does not limit the priority order of the embodiments.
[0063] According to Figure 1 the cursor movement method shown, the method at least includes steps S110 to S150, which are introduced in detail as follows:
[0064] In step S110, the focus element and non - focus element of the current page are obtained.
[0065] The current page is the page currently displayed on the screen of the terminal. The page can have one or more elements, and the elements can be selected by the cursor.
[0066] In one embodiment, the current page can be a TV browser page. The TV browser page can refer to Figure 2 , Figure 2 in which the multiple solid - line frames such as "Children", "Highlights", "TV Series", "Movies", "Resume Last Watched Program", "Recommended Programs", "File Management", "What Everyone Is Watching", and "User Center" are all elements. The cursor can move among the multiple elements.
[0067] Elements include focus elements and non - focus elements. The priority of the focus element is higher than that of the non - focus element. The focus element can be an element with a priority higher than the priority threshold, and the non - focus element can be an element with a priority not higher than the priority threshold. The priority threshold can be set according to actual needs.
[0068] The priority of the element can be pre - configured or determined according to the usage frequency of the element. The usage frequency of the element can be the historical usage frequency of each element on the terminal statistically, or determined according to big data or a neural network model.
[0069] In one embodiment, there may also be differences in the priorities of the elements that are all focus elements, and there may also be differences in the priorities of the elements that are all non - focus elements. The priority of the element is proportional to the usage frequency of the element. The priority of the element with a high usage frequency is higher than that of the element with a low usage frequency.
[0070] In another embodiment, the priorities of all elements that are focus elements are the same, and the priorities of all elements that are non-focus elements are the same. When the usage frequency of an element exceeds a usage frequency threshold, the element is determined as a focus element, and the priority of the focus element is determined as a first value; when the usage frequency of an element does not exceed the usage frequency threshold, the element is determined as a non-focus element, and the priority of the non-focus element is determined as a second value; the priority represented by the first value is higher than the priority represented by the second value.
[0071] As an example, in Figure 2 the page shown, the frequency of selecting "Continue playing the program watched last time" is relatively high, so it can be determined that the priority of the element corresponding to "Continue playing the program watched last time" is relatively high, and then this element is determined as a focus element.
[0072] The movement of the cursor is a jump movement among multiple elements. For example, the cursor can directly move from one element to another element that is relatively far away. If there are elements with different priorities within the movement range of the cursor, it will first move to the element with the highest priority within this movement range.
[0073] In one embodiment, the obtaining of the focus elements and non-focus elements of the current page may include: obtaining the Document Object Model (DOM) tree of the current page; parsing and traversing the DOM tree of the current page to obtain the focus elements and the non-focus elements of the current page.
[0074] The Document Object Model (DOM) tree is a conceptual model that represents the logical structure and content of a document in a tree-like structure. The DOM tree can regard each element, attribute, text node, etc. in the document as a node in the tree, so that developers can access, operate on, and modify the content, structure, and style of the document through programming languages, and implement functions such as dynamically updating the page and responding to user interactions.
[0075] The DOM tree of the current page can be obtained through the document object, and the DOM tree of the current page can be parsed. By traversing the nodes in the parsed DOM tree, it is possible to determine whether the nodes in the DOM tree are focus elements or non-focus elements through the attributes, names, and / or characteristics of each node, so as to obtain the focus elements and non-focus elements of the current page.
[0076] In this way, by parsing and traversing the DOM tree of the current page, the focus elements and non-focus elements in the current page can be quickly obtained, which is convenient for quickly determining the cursor movement position subsequently.
[0077] Optionally, the positions and sizes of individual elements can be obtained and recorded from the DOM tree, where the position of an element can be characterized by the coordinates of the center point of the element.
[0078] In step S120, when a navigation operation is detected, determine the moving direction of the cursor.
[0079] The cursor moves between elements. In one embodiment, the cursor can be in the form of a small arrow shape or a palm shape, etc. For example, the cursor is in the form of a small arrow. When the cursor is on element A, it can be represented as having an arrow at the center point of element A, and this arrow is the cursor.
[0080] In another embodiment, the manifestation form of the cursor can change according to the element where the cursor is located. For example, if element A is circular, when the cursor is on element A, it can be such that there is a circle of white light outside the circle where element A is located. At this time, the cursor is manifested as a circular white light slightly larger than element A. If element B is rectangular, when the cursor moves from element A to element B, the circular white light outside the circle where element A is located can disappear, and a circle of rectangular white light is added outside the rectangle where element B is located. At this time, the cursor is manifested as a rectangular white light slightly larger than element B.
[0081] A navigation operation refers to an operation that drives the cursor to move in a certain direction. The direction indicated by the navigation operation is determined as the moving direction of the cursor.
[0082] For example, a remote control has four navigation buttons: "up", "down", "left", and "right". Pressing any navigation button will trigger a navigation operation. When the "up" button on the remote control is pressed, it can be determined that the moving direction of the cursor is upward. Among them, the remote control will transmit the navigation operation to the terminal. When the terminal detects the navigation operation, it can determine the moving direction of the cursor according to the navigation button corresponding to the navigation operation.
[0083] In one embodiment, when the cursor moves in a certain direction, it can not only move straight in that direction, but also include moving obliquely in that direction. For example, when the cursor moves upward, it can include the cursor moving directly upward, diagonally upward to the left, and diagonally upward to the right. When the cursor moves to the left, it can include the cursor moving directly to the left, diagonally upward to the left, and diagonally downward to the right. The same applies to other directions.
[0084] In step S130, obtain the current position of the cursor.
[0085] The current position of the cursor can be the coordinates of the center point where the cursor is currently located. The current position of the cursor can be obtained through the onTouchEvent method or a function in JavaScript.
[0086] In step S140, the moving range of the cursor is determined according to the moving direction and the current position of the cursor.
[0087] Based on the moving direction and the current position of the cursor, the moving range of the cursor can be determined. For example, when the moving direction is left, all positions to the right of the current position of the cursor on the current page are the moving positions of the cursor.
[0088] In one embodiment, the moving range of the cursor can be determined according to the moving direction of the cursor and the coordinates of the current position of the cursor. For example, the leftmost abscissa of the current page is 0, the rightmost abscissa is N, the bottommost ordinate is 0, the uppermost ordinate is M, and the coordinates of the current position of the cursor are (x, y); then when the moving direction of the cursor is upward, the value range of the abscissa of the moving range of the cursor is [0, N], and the value range of the ordinate is (y, M]; when the moving direction of the cursor is downward, the value range of the abscissa of the moving range of the cursor is [0, N], and the value range of the ordinate is [0, y); when the moving direction of the cursor is to the right, the value range of the ordinate of the moving range of the cursor is [0, M], and the value range of the abscissa is (x, N]; when the moving direction of the cursor is downward, the value range of the ordinate of the moving range of the cursor is [0, M], and the value range of the abscissa is [0, x).
[0089] In step S150, the moving position of the cursor is determined according to whether the moving range of the cursor includes the focus element or the non - focus element.
[0090] The positions of each element can be obtained and recorded from the DOM tree. According to the moving range of the cursor and the positions of each element, it is determined whether the moving range of the cursor includes the focus element or the non - focus element, so as to determine the moving position of the cursor.
[0091] When the moving range of the cursor includes the focus element, regardless of whether it includes the non - focus element, the cursor is moved to the position where the focus element in the moving range is located. When the moving range of the cursor does not include the focus element but includes the non - focus element, the cursor is moved to the position where the non - focus element in the moving range is located. When the moving range of the cursor includes neither the focus element nor the non - focus element, the cursor remains stationary.
[0092] By adopting the technical solution of the embodiment of the present application, elements are divided into focus elements and non-focus elements. When a navigation operation is monitored, the moving range of the cursor can be determined according to the current position and moving direction of the cursor, so as to determine the moving position of the cursor according to whether the moving range of the cursor includes a focus element or a non-focus element. In this way, the focus elements and non-focus elements are distinguished, so the moving position of the cursor will be different in different situations, and thus it is possible to quickly move to the expected element and improve the user experience.
[0093] Based on the above technical solution, as an embodiment, determining the moving position of the cursor according to whether the moving range of the cursor includes the focus element or the non-focus element may include: when the moving range of the cursor includes the focus element, moving the cursor to the position of the focus element.
[0094] When the moving range of the cursor includes a focus element, there is no need to further determine whether the moving range includes a non-focus element, but directly move the cursor to the position of the focus element within the moving range. Moving the cursor to the position of the focus element may be to make the center point coordinates of the cursor consistent with the center point coordinates of the focus element.
[0095] In one embodiment, if the moving range of the cursor includes one focus element, the cursor can be directly moved into the focus element.
[0096] In another embodiment, if the moving range of the cursor includes multiple focus elements and the priorities of the multiple focus elements are the same, the cursor can be moved to the focus element closest to the cursor within the moving range.
[0097] In still another embodiment, if the moving range of the cursor includes multiple focus elements and the priorities of the multiple focus elements are inconsistent, the cursor can be moved to the focus element with the highest priority within the moving range.
[0098] In the related art, elements are not distinguished. If you want to move to a target element, you need to move the cursor "one grid" each time until you move to the target element. For example, in Figure 2 the shown elements, if the cursor is currently on the "Children" element and you want to move the cursor to the "Continue Playing the Last Watched Program" element, the related art may need to first press the "down" key to move the cursor to the "User Center" element, and then press the "right" key to move the cursor to the "Continue Playing the Last Watched Program" element, which requires a total of two key operations.
[0099] In one embodiment of the present application, in Figure 2Among the elements shown, the cursor is currently on the "Children" element. If the "Resume Playing the Last Watched Program" element is the only focus element below the "Children" element on the current page, the cursor can be directly moved to the "Resume Playing the Last Watched Program" focus element by pressing the "Down" key, and only one key operation is required in total.
[0100] Adopting the technical solution of the embodiment of the present application, when the focus element is included in the moving range of the cursor, the cursor can be directly moved to the position where the focus element in the moving range is located. Since the focus element is an element with a relatively high usage frequency, directly moving the cursor to the focus element can simplify the user operation and improve the user experience compared with first moving the cursor to a non-focus element and then to the focus element.
[0101] On the basis of the above technical solution, as an embodiment, when multiple focus elements are included in the moving range of the cursor, moving the cursor to the position of the focus element may include: obtaining the positions and sizes of the multiple focus elements in the moving range; according to the positions and sizes of the multiple focus elements in the moving range, determining the first focus element that the cursor will contact when moving from the current position in the moving direction; moving the cursor to the position of the first focus element.
[0102] The positions and sizes of the multiple focus elements in the moving range can be obtained from the parsed DOM tree. The position of the focus element is represented by the center point coordinates of the focus element.
[0103] In one embodiment, the shape of the focus element can be a fixed shape, for example, all are rectangles or all are circles; then, according to the position and size of the focus element, the maximum and minimum values of the abscissa of the edge points of the focus element can be determined, and the maximum and minimum values of the ordinate of the edge points of the focus element can be determined.
[0104] In another embodiment, the shapes of the elements may be different, then the shape of the element can be obtained, and according to the position, size and shape of the focus element, the maximum and minimum values of the abscissa of the edge points of the focus element can be determined, and the maximum and minimum values of the ordinate of the edge points of the focus element can be determined.
[0105] The cursor moving from the current position in the moving direction and contacting the first focus element can be determined according to the maximum and minimum values of the abscissa of the edge points of each focus element, or the maximum and minimum values of the ordinate of the edge points of each focus element.
[0106] For example, the coordinates of the current position of the cursor are (x, y). When the moving direction of the cursor is downward, the value range of the abscissa of the moving range of the cursor is [0, N], and the value range of the ordinate is [0, y); the maximum value of the ordinates of the edge points of each focus element within the moving range can be determined, and the focus element with the maximum maximum value of the ordinates of the edge points is determined as the first focus element that the cursor will contact when moving from the current position in the moving direction.
[0107] A straight line perpendicular to the moving direction of the cursor can be imagined or determined; the first focus element that the straight line will contact when moving from the current position of the cursor in the moving direction of the cursor is the first focus element that the cursor will contact when moving from the current position in the moving direction.
[0108] After determining the first focus element that the cursor will contact when moving from the current position in the moving direction, the cursor can be directly moved to the position of the first focus element.
[0109] In one embodiment, if there are multiple focus elements that the cursor will first contact simultaneously when moving from the current position in the moving direction, one of the focus elements can be randomly selected as the focus element that the cursor will move to; alternatively, the focus element with the shortest straight-line distance from the cursor among the multiple focus elements that are first contacted simultaneously can be determined as the focus element that the cursor will move to.
[0110] Adopting the technical solution of the embodiment of the present application, when there are multiple focus elements within the moving range of the cursor, the cursor can be moved to the position of the first focus element that will be contacted when moving from the current position in the moving direction, thereby avoiding the problem of confusion that may occur when there are multiple focus elements within the moving range of the cursor.
[0111] On the basis of the above technical solution, as an embodiment, determining the moving position of the cursor according to whether the focus element or the non-focus element is included within the moving range of the cursor may include: when the focus element is not included but the non-focus element is included within the moving range of the cursor, moving the cursor to the position of the non-focus element.
[0112] When the focus element is not included but the non-focus element is included within the moving range of the cursor, the cursor can be moved to the position of the non-focus element within the moving range. Moving the cursor to the position of the non-focus element can be to make the center point coordinates of the cursor consistent with the center point coordinates of the non-focus element.
[0113] In one embodiment, if the moving range of the cursor does not include the focus element but includes a non - focus element, the cursor can be directly moved into the non - focus element.
[0114] In another embodiment, if the moving range of the cursor does not include the focus element but includes multiple non - focus elements and the priorities of the multiple non - focus elements are the same, the cursor can be moved to the non - focus element in the moving range that is closest to the cursor.
[0115] In yet another embodiment, if the moving range of the cursor does not include the focus element but includes multiple non - focus elements and the priorities of the multiple non - focus elements are not the same, the cursor can be moved to the non - focus element with the highest priority in the moving range.
[0116] By adopting the technical solution of the embodiment of the present application, when the moving range of the cursor does not include the focus element but includes non - focus elements, the moving logic of the cursor is still specified, so as to realize the movement of the cursor in non - focus elements.
[0117] On the basis of the above - mentioned technical solution, as an embodiment, when the moving range of the cursor does not include the focus element but includes multiple non - focus elements, the position of moving the cursor to the non - focus element may include: obtaining the positions and sizes of the multiple non - focus elements in the moving range; according to the positions and sizes of the multiple non - focus elements in the moving range, determining the first non - focus element that the cursor will contact when moving from the current position in the moving direction; moving the cursor to the position of the first non - focus element.
[0118] The positions and sizes of the multiple non - focus elements in the moving range can be obtained from the parsed DOM tree. The position of the non - focus element is represented by the center - point coordinates of the non - focus element.
[0119] In one embodiment, the shape of the non - focus element can be a fixed shape, for example, all are rectangles or all are circles; then, according to the position and size of the non - focus element, the maximum and minimum values of the abscissa of the edge points of the non - focus element can be determined, and the maximum and minimum values of the ordinate of the edge points of the non - focus element can be determined.
[0120] In another embodiment, the shapes of the elements may be different, then the shape of the element can be obtained, and according to the position, size and shape of the non - focus element, the maximum and minimum values of the abscissa of the edge points of the non - focus element can be determined, and the maximum and minimum values of the ordinate of the edge points of the non - focus element can be determined.
[0121] The cursor moves from the current position in the moving direction and touches the first non - focus element, which can be determined according to the maximum and minimum values of the abscissas of the edge points of each non - focus element, or the maximum and minimum values of the ordinates.
[0122] For example, the coordinates of the current position of the cursor are (x, y). When the moving direction of the cursor is downward, the value range of the abscissa of the moving range of the cursor is [0, N], and the value range of the ordinate is [0, y). The maximum value of the ordinates of the edge points of each non - focus element within the moving range can be determined, and the non - focus element with the largest maximum value of the ordinates of the edge points is determined as the first non - focus element that the cursor will touch when moving from the current position in the moving direction.
[0123] A straight line perpendicular to the moving direction of the cursor can be imagined or determined; when this straight line moves from the current position of the cursor in the moving direction of the cursor, the first non - focus element it touches is the first non - focus element that the cursor will touch when moving from the current position in the moving direction.
[0124] After determining the first non - focus element that the cursor will touch when moving from the current position in the moving direction, the cursor can be directly moved to the position of this first non - focus element.
[0125] In one embodiment, if the cursor touches multiple non - focus elements simultaneously when moving from the current position in the moving direction, one of the non - focus elements can be randomly selected as the non - focus element that the cursor will move to; or the non - focus element with the shortest straight - line distance from the cursor among the multiple non - focus elements touched simultaneously can be determined as the non - focus element that the cursor will move to.
[0126] Adopting the technical solution of the embodiment of the present application, when there are multiple non - focus elements within the moving range of the cursor, the cursor can be moved to the position of the first non - focus element that it will touch when moving from the current position in the moving direction, thus avoiding the problem of chaos that may occur when there are multiple non - focus elements within the moving range of the cursor.
[0127] On the basis of the above - mentioned technical solution, as an embodiment, determining the moving position of the cursor according to whether the focus element or the non - focus element is included in the moving range of the cursor may include: when neither the focus element nor the non - focus element is included in the moving range of the cursor, keeping the cursor stationary.
[0128] When neither the focus element nor the non - focus element is included in the moving range of the cursor, keep the cursor stationary.
[0129] For example, when the cursor is on the leftmost element and the cursor's moving direction is to the left, there is no element within the moving range of the cursor. Therefore, the cursor remains stationary.
[0130] In this way, by keeping the cursor stationary, the user can be informed that the current key operation is incorrect.
[0131] As an embodiment, Figure 3 is a schematic flowchart of a cursor movement method provided by an embodiment of the present application. In step S1, the TV browser is started and initialized. In step S2, the elements of the current page are obtained. In step S3, the input of the remote control is monitored. In step S4, it is determined whether to change the cursor position. When it is necessary to change the cursor position, it jumps to step S5; when it is not necessary to change the cursor position, it jumps to step S3. In step S5, the position of the target element is obtained. In step S6, the cursor is moved to the position of the target element.
[0132] Among them, by monitoring the input of the remote control, the moving direction of the cursor can be determined. It can be determined whether to change the cursor position by whether the moving range of the cursor includes the focus element or the non - focus element. The target element can be the position to which the cursor will move as described above.
[0133] By adopting the technical solution of the embodiment of the present application, it is possible to quickly move to the expected element, simplify the user operation, and improve the user experience.
[0134] Based on the above - mentioned technical solution, when both the focus element and the non - focus element are included in the moving range of the cursor, if you want to move to the non - focus element, you can move the cursor to the non - focus element by performing a target operation. The target operation can be pressing the direction key twice in a row. When the terminal monitors the target operation, it can move the cursor in sequence according to the positions of the elements, and each time move the cursor to the element closest to the current position of the cursor in the moving direction indicated by the target operation.
[0135] Based on the above - mentioned technical solution, there is only one focus in a page. When both the focus element and the non - focus element are included in the moving range of the cursor, if you want to move to the non - focus element, you can first move to the focus element and then move from the focus element to the non - focus element.
[0136] To facilitate better implementation of the cursor movement method of the present application, the present application also provides a cursor movement device based on the above - mentioned cursor movement method. The meanings of the nouns are the same as those in the above - mentioned cursor movement method, and the specific implementation details can refer to the description in the method embodiment.
[0137] Please refer to Figure 4 ,Figure 4 It is a schematic structural diagram of a cursor movement device provided by an embodiment of the present application, where the cursor movement device includes:
[0138] An element acquisition module 401, configured to acquire a focus element and a non-focus element of the current page;
[0139] A direction determination module 402, configured to determine the movement direction of the cursor when a navigation operation is monitored;
[0140] A position acquisition module 403, configured to acquire the current position of the cursor;
[0141] A range determination module 404, configured to determine the movement range of the cursor according to the movement direction and the current position of the cursor; and
[0142] A position determination module 405, configured to determine the movement position of the cursor according to whether the focus element or the non-focus element is included in the movement range of the cursor.
[0143] In one embodiment, the position determination module 405 includes:
[0144] A first movement unit, configured to move the cursor to the position of the focus element when the focus element is included in the movement range of the cursor.
[0145] In one embodiment, when multiple focus elements are included in the movement range of the cursor, the first movement unit includes:
[0146] A first acquisition subunit, configured to acquire the positions and sizes of the multiple focus elements within the movement range;
[0147] A first determination subunit, configured to determine the first focus element that the cursor will contact when moving from the current position in the movement direction according to the positions and sizes of the multiple focus elements within the movement range;
[0148] A first movement subunit, configured to move the cursor to the position of the first focus element.
[0149] In one embodiment, the position determination module 405 includes:
[0150] A second movement unit, configured to move the cursor to the position of the non-focus element when the focus element is not included in the movement range of the cursor but the non-focus element is included.
[0151] In one embodiment, when the focus element is not included in the movement range of the cursor but multiple non-focus elements are included, the second movement unit includes:
[0152] A second acquisition subunit, configured to acquire the positions and sizes of multiple non-focus elements within the moving range;
[0153] A second determination subunit, configured to determine, according to the positions and sizes of multiple non-focus elements within the moving range, the first non-focus element that the cursor will contact when moving from the current position in the moving direction;
[0154] A second movement subunit, configured to move the cursor to the position of the first non-focus element.
[0155] In one embodiment, the position determination module 405 includes:
[0156] A stay still unit, configured to keep the cursor still when the focus element and the non-focus element are not included in the moving range of the cursor.
[0157] In one embodiment, the element acquisition module 401 includes:
[0158] A tree acquisition unit, configured to acquire the document object model (DOM) tree of the current page;
[0159] An analysis unit, configured to analyze and traverse the DOM tree of the current page to obtain the focus element and the non-focus element of the current page.
[0160] By adopting the technical solution of the embodiment of the present application, elements are divided into focus elements and non-focus elements. When a navigation operation is monitored, the moving range of the cursor can be determined according to the current position and the moving direction of the cursor, so as to determine the moving position of the cursor according to whether the focus element or the non-focus element is included in the moving range of the cursor. In this way, the focus element and the non-focus element are distinguished, so the moving position of the cursor will be different in different situations, and thus it can be quickly moved to the expected element, improving the user experience.
[0161] For the specific definition of the cursor movement device, reference may be made to the definition of the cursor movement method in the foregoing text, which will not be elaborated herein. Each module in the foregoing cursor movement device can be implemented in whole or in part by software, hardware, and their combination. The foregoing modules can be embedded in or independent of the processor in the computer device in the form of hardware, or stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the foregoing modules.
[0162] In addition, the present application further provides an electronic device, as Figure 5 shown, which shows the structural schematic diagram of the electronic device involved in the present application. Specifically:
[0163] The electronic device may include components such as a processor 501 with one or more processing cores and a memory 502 with one or more computer-readable storage media. Those skilled in the art can understand that Figure 5 the structure of the electronic device shown in
[0164] does not limit the electronic device, and it may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements. Among them:
[0165] The processor 501 is the control center of the electronic device, connecting various parts of the entire electronic device through various interfaces and circuits. By running or executing software programs and / or modules stored in the memory 502, and by calling data stored in the memory 502, it executes various functions of the electronic device and processes data, thereby monitoring the electronic device as a whole. Optionally, the processor 501 may include one or more processing cores; preferably, the processor 501 may integrate an application processor and a modem processor. Among them, the application processor mainly processes the operating system, user interface, application programs, etc., and the modem processor mainly processes wireless communication. It can be understood that the above-mentioned modem processor may not be integrated into the processor 501 either.
[0166] In one embodiment, the electronic device further includes a power supply 503 that powers each component. Preferably, the power supply 503 can be logically connected to the processor 501 through a power management system, so as to realize functions such as management of charging, discharging, and power consumption management through the power management system. The power supply 503 may also include any components such as one or more DC or AC power supplies, a recharge system, a power device debugging circuit, a power converter or inverter, and a power status indicator.
[0167] In one embodiment, the electronic device may further include an input unit 504, which may be used to receive input digital or character information, and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function controls.
[0168] Although not shown, the electronic device may further include a display unit and the like, which will not be elaborated here. Specifically, in this embodiment, the processor 501 in the electronic device will load the executable files corresponding to the processes of one or more application programs into the memory 502 according to the following instructions, and the processor 501 will run the application programs stored in the memory 502, so as to implement the steps in any one of the cursor movement methods provided by the embodiments of the present application.
[0169] Those skilled in the art can understand that Figure 5 the structure shown in
[0170] In one embodiment, an electronic device is provided, including a memory and a processor. A computer program is stored in the memory, and when the processor executes the computer program, the method described in any embodiment of the present application is implemented.
[0171] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the method described in any embodiment of the present application is implemented.
[0172] In some embodiments, a computer program product is further proposed, including a computer program or instruction. When the computer program or instruction is executed by a processor, the method described in any embodiment of the present application is implemented.
[0173] For the specific implementation of the above operations, reference may be made to the previous embodiments, which will not be elaborated here.
[0174] Those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructions, or by controlling related hardware through instructions. The instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.
[0175] Therefore, the present application provides a computer-readable storage medium, on which a computer program is stored. The computer program can be loaded by a processor to execute the steps in any one of the cursor movement methods provided by the present application.
[0176] For the specific implementation of each of the above operations, reference may be made to the previous embodiments, which will not be elaborated herein.
[0177] Among them, the computer-readable storage medium may include: read-only memory (ROM, Read Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disk, etc.
[0178] Since the instructions stored in the computer-readable storage medium can execute the steps in any of the cursor movement methods provided in this application, the beneficial effects achievable by any of the cursor movement methods provided in this application can be realized. For details, refer to the previous embodiments, which will not be elaborated herein.
[0179] Finally, it should also be noted that in this text, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or terminal device comprising a series of elements not only includes those elements, but also includes other elements not expressly listed, or elements inherent to such process, method, article or terminal device. Without further limitation, an element defined by the statement "comprising an..." does not exclude the existence of additional identical elements in the process, method, article or terminal device comprising the element.
[0180] The above has introduced in detail a cursor movement method, apparatus, electronic device and computer-readable storage medium provided in this application. Specific examples are used in this text to elaborate on the principles and implementation manners of the present invention. The description of the above embodiments is only used to help understand the method and its core idea of the present invention; at the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation manners and application scopes. In summary, the content of this specification should not be construed as a limitation to the present invention.
Claims
1. A cursor moving method, characterized in that: include: Get the focus element and non-focus element of the current page; When a navigation operation is detected, the direction of cursor movement is determined; Get the current position of the cursor; Determining a moving range of the cursor according to the moving direction and current position of the cursor; and The moving position of the cursor is determined according to whether the moving range of the cursor includes the focus element or the non-focus element.
2. The method according to claim 1, characterized in that The step of determining the moving position of the cursor according to whether the moving range of the cursor includes the focus element or the non-focus element comprises: When the focus element is included in the moving range of the cursor, the cursor is moved to the position of the focus element.
3. The method according to claim 2, characterized in that When a plurality of focus elements are included in the moving range of the cursor, moving the cursor to the position of the focus element comprises: Obtaining respective positions and sizes of a plurality of focus elements within the moving range; Determining, according to respective positions and sizes of the plurality of focus elements within the moving range, a first focus element that the cursor will touch when moving from the current position to the moving direction; Move the cursor to the position of the first focused element.
4. The method according to claim 1, characterized in that: The step of determining the moving position of the cursor according to whether the moving range of the cursor includes the focus element or the non-focus element comprises: When the moving range of the cursor does not include the focus element but includes the non-focus element, the cursor is moved to the position of the non-focus element.
5. The method according to claim 4, characterized in that When the moving range of the cursor does not include the focus element but includes a plurality of the non-focus elements, moving the cursor to the position of the non-focus element includes: Obtaining respective positions and sizes of a plurality of the non-focus elements within the moving range; Determining, according to respective positions and sizes of the plurality of non-focus elements within the moving range, a first non-focus element that the cursor will touch when moving from the current position to the moving direction; Move the cursor to the position of the first non-focused element.
6. The method according to claim 1, characterized in that The step of determining the moving position of the cursor according to whether the moving range of the cursor includes the focus element or the non-focus element comprises: When the focus element and the non-focus element are not included in the moving range of the cursor, the cursor is kept stationary.
7. The method according to claim 1, characterized in that The method of obtaining the focus element and non-focus element of the current page includes: Get the document object model DOM tree of the current page; Parse and traverse the DOM tree of the current page to obtain the focus element and the non-focus element of the current page.
8. A cursor moving device, characterized in that: include: Element acquisition module, used to obtain the focus element and non-focus element of the current page; A direction determination module is used to determine the direction of cursor movement when a navigation operation is monitored; A position acquisition module, used to acquire the current position of the cursor; A range determination module, used to determine the moving range of the cursor according to the moving direction and current position of the cursor; as well as The position determination module is used to determine the moving position of the cursor according to whether the moving range of the cursor includes the focus element or the non-focus element.
9. An electronic device, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps in the cursor movement method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the cursor movement method according to any one of claims 1 to 7 are implemented.