Touch event processing method and apparatus, device, and storage medium
By defining the response relationships of view nodes in the user interface, the problems of gesture conflicts and inconsistent interaction methods in traditional touch technology are solved, achieving consistency and accuracy in touch event processing across operating systems.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- BEIJING ZITIAO NETWORK TECH CO LTD
- Filing Date
- 2025-08-19
- Publication Date
- 2026-05-07
AI Technical Summary
Traditional touch technology is prone to conflicts when coordinating multiple gesture interactions, affecting the accuracy of touch operation and the interactive experience. Furthermore, differences in the processing logic of different operating systems lead to inconsistent interaction methods.
By identifying candidate view nodes associated with touch events from multiple view nodes in the user interface, determining response relationships based on the relationships between candidate view nodes, and recognizing and executing corresponding gesture operations according to the response relationships, gesture conflicts are avoided and cross-operating system interaction consistency is achieved.
This ensures that view nodes can recognize and respond to gestures according to their response relationships, avoiding gesture conflicts, and also achieving consistency in the interaction methods of the same application on different operating systems.
Smart Images

Figure CN2025115729_07052026_PF_FP_ABST
Abstract
Description
Touch event handling methods, apparatus, devices and storage media
[0001] This application claims priority to Chinese Patent Application No. 202411515622.8, filed on October 28, 2024, entitled "Touch Event Processing Method, Apparatus, Device and Storage Medium", the entire contents of which are incorporated herein by reference. Technical Field
[0002] The exemplary embodiments disclosed herein generally relate to the field of computers, and particularly to touch event handling methods, apparatus, devices, computer-readable storage media, and computer program products. Background Technology
[0003] With the development of computer technology, touchscreen technology has been widely applied to various electronic devices. Not only are various mobile devices equipped with touchscreens, but also many sizes of display devices, fixed terminal devices, and home appliances. Users can flexibly operate these electronic devices using various gestures such as clicking, long pressing, dragging, and inertial swiping. However, the performance of traditional touch technology in coordinating multiple gestures still needs improvement. Summary of the Invention
[0004] In a first aspect of this disclosure, a touch event processing method is provided. The method includes: in response to detecting a touch event on a user interface, determining at least one candidate view node associated with the touch event from a plurality of view nodes of the user interface, each candidate view node having a corresponding predetermined gesture; determining a response relationship between the at least one candidate view node and the touch event based on the association relationship between the at least one candidate view node; identifying a corresponding predetermined gesture for a candidate view node among the at least one candidate view node based on the touch event, according to the response relationship; and in response to identifying a corresponding predetermined gesture for a target view node among the at least one candidate view node, performing a corresponding target operation based on the touch event through the target view node.
[0005] In a second aspect of this disclosure, an apparatus for touch event processing is provided. The apparatus includes: a response module configured to, in response to detecting a touch event on a user interface, determine at least one candidate view node associated with the touch event from a plurality of view nodes of the user interface, each candidate view node having a corresponding predetermined gesture; a determination module configured to determine a response relationship between the at least one candidate view node and the touch event based on an association relationship between the at least one candidate view node; an identification module configured to, based on the response relationship, identify a corresponding predetermined gesture for a candidate view node among the at least one candidate view node based on the touch event; and an execution module configured to, in response to identifying a corresponding predetermined gesture for a target view node among the at least one candidate view node, perform a corresponding target operation based on the touch event through the target view node.
[0006] In a third aspect of this disclosure, an electronic device is provided. The device includes at least one processor; and at least one memory coupled to the at least one processor and storing instructions for execution by the at least one processor. When executed by the at least one processor, the instructions cause the device to perform the method of the first aspect.
[0007] In a fourth aspect of this disclosure, a computer-readable storage medium is provided. The computer-readable storage medium stores computer-executable instructions that can be executed by a processor to implement the method of the first aspect.
[0008] In a fifth aspect of this disclosure, a computer program product is provided, including computer-executable instructions, wherein when executed by a processor, the computer-executable instructions implement the method according to a first aspect of this disclosure.
[0009] It should be understood that the content described in this content section is not intended to limit the key or essential features of the embodiments of this disclosure, nor is it intended to restrict the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description
[0010] 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. In the drawings, the same or similar reference numerals denote the same or similar elements, wherein:
[0011] Figure 1 shows a schematic diagram of an example environment in which embodiments of the present disclosure may be implemented;
[0012] Figure 2 shows a flowchart of a touch event handling process according to some embodiments of the present disclosure;
[0013] Figures 3A to 6C respectively show schematic diagrams of examples of user interfaces according to some embodiments of the present disclosure;
[0014] Figures 7 and 8 respectively show schematic diagrams of examples of response flow graphs according to some embodiments of the present disclosure;
[0015] Figure 9 shows a schematic structural block diagram of an example device for touch event handling according to some embodiments of the present disclosure; and
[0016] Figure 10 shows a block diagram of an electronic device capable of implementing several embodiments of the present disclosure. Detailed Implementation
[0017] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.
[0018] It should be noted that the headings of any section / subsection provided herein are not limiting. Various embodiments are described throughout this document, and embodiments of any type may be included under any section / subsection. Furthermore, embodiments described in any section / subsection may be combined in any way with any other embodiments described in the same section / subsection and / or different sections / subsections.
[0019] In the description of embodiments of this disclosure, the term "comprising" and similar terms should be understood as open-ended inclusion, i.e., "including but not limited to". The term "based on" should be understood as "at least partially based on". The term "one embodiment" or "the embodiment" should be understood as "at least one embodiment". The term "some embodiments" should be understood as "at least some embodiments". Other explicit and implicit definitions may also be included below. The terms "first", "second", etc., may refer to different or the same objects. Other explicit and implicit definitions may also be included below.
[0020] The embodiments of this disclosure may involve user data, data acquisition, and / or use. All of these aspects comply with applicable laws, regulations, and relevant provisions. In the embodiments of this disclosure, all data collection, acquisition, processing, manipulation, forwarding, and use are conducted with the user's knowledge and confirmation. Accordingly, in implementing the embodiments of this disclosure, the type, scope of use, and usage scenarios of any data or information that may be involved should be communicated to the user and their authorization obtained in accordance with relevant laws and regulations through appropriate means. The specific methods of notification and / or authorization may vary depending on the actual situation and application scenario, and the scope of this disclosure is not limited in this respect.
[0021] In this specification and the embodiments, any processing of personal information will be carried out only under the premise of legality (such as obtaining the consent of the personal information subject, or being necessary for the performance of a contract), and will only be carried out within the scope stipulated or agreed upon. A user's refusal to process personal information other than that necessary for basic functions will not affect the user's use of basic functions.
[0022] As mentioned above, with the development of computer technology, touchscreen technology has been widely applied to various electronic devices. Not only are various mobile devices equipped with touchscreens, but also many sizes of display devices, fixed terminal devices, and home appliances. Users can flexibly operate these electronic devices using various gestures such as clicking, long pressing, dragging, and inertial swiping. However, traditional touch technology suffers from two main problems. First, in scenarios involving coordinating multiple gesture interactions, conflicts can easily arise between gestures, affecting the accuracy of touch operation and the interactive experience. Second, traditional touch technology relies on the operating system to process and distribute touch events. Because different operating systems have different logic for handling touch events, the interaction methods of the same application differ on different operating systems.
[0023] Embodiments of this disclosure propose an improved scheme for touch event handling. In this scheme, in response to the detection of a touch event on the user interface, at least one candidate view node associated with the touch event is determined from a plurality of view nodes of the user interface. Each of the at least one candidate view node has a corresponding predetermined gesture. Based on the association relationship between the at least one candidate view node, a response relationship of the at least one candidate view node to the touch event is determined. According to the response relationship, a corresponding predetermined gesture is identified for the candidate view node among the at least one candidate view node based on the touch event. If a target view node among the at least one candidate view node identifies the corresponding predetermined gesture, the corresponding target operation is performed through the target view node based on the touch event.
[0024] In this manner, embodiments of this disclosure allocate touch events to view nodes based on the response relationships between view nodes in the user interface. This ensures that each view node can perform gesture recognition and gesture response according to the response relationships, thereby avoiding gesture conflicts. Furthermore, embodiments of this disclosure do not rely on the operating system for processing and allocating touch events. For the same application, even when deployed on different operating systems, consistency in interaction methods can be achieved.
[0025] The following section provides a detailed description of various example implementations of this scheme, with reference to the accompanying drawings.
[0026] Example Environment
[0027] Figure 1 illustrates a schematic diagram of an example environment 100 in which embodiments of the present disclosure can be implemented. In this example environment 100, an application 120 is installed on a terminal device 110. A user 140 can interact with the application 120 via the terminal device 110 and / or an attached device of the terminal device 110.
[0028] In the embodiments of this disclosure, application 120 can be any suitable application, and the embodiments of this disclosure do not limit the functions and services provided by application 120. In the environment of FIG1, if application 120 is active, terminal device 110 can display the interface 150 of application 120. Interface 150 may include various interfaces that application 120 can provide.
[0029] In some embodiments, terminal device 110 communicates with server 130 to provide services to application 120. Terminal device 110 can be any type of mobile terminal, fixed terminal, or portable terminal, including mobile phones, desktop computers, laptop computers, notebook computers, netbook computers, tablet computers, media computers, multimedia tablets, personal communication system (PCS) devices, personal navigation devices, personal digital assistants (PDAs), audio / video players, digital cameras / camcorders, positioning devices, television receivers, radio receivers, e-book devices, gaming devices, or any combination thereof, including accessories and peripherals of these devices or any combination thereof. In some embodiments, terminal device 110 can also support any type of user-facing interface (such as "wearable" circuitry). Server 130 can be various types of computing systems / servers capable of providing computing power, including but not limited to mainframes, edge computing nodes, computing devices in cloud environments, etc.
[0030] It should be understood that the structure and function of the various elements in environment 100 are described for illustrative purposes only and do not imply any limitation on the scope of this disclosure.
[0031] The following description will continue with reference to the accompanying drawings, which will provide some exemplary embodiments of this disclosure.
[0032] Example process
[0033] Figure 2 illustrates a flowchart of a touch event handling process 200 according to some embodiments of the present disclosure. For ease of discussion, some embodiments of the present disclosure will be described below in conjunction with the environment 100 in Figure 1 and from the perspective of a terminal device 110, but this is merely exemplary. In some embodiments, the actions described relative to the terminal device may be performed jointly by the terminal device and the server.
[0034] In block 210 of process 200, terminal device 110 responds to a detected touch event on the user interface by determining at least one candidate view node associated with the touch event from a plurality of view nodes of the user interface. The user interface may be the interface 150 of application 120 running on terminal device 110, or other interfaces of terminal device 110. A view node is a component or element of the user interface, and the user interface may include multiple view nodes. View nodes may include visible elements in the user interface, such as options, buttons, text, images, etc. View nodes may also include invisible elements in the user interface, such as containers, frames, etc.
[0035] Touch events can include events where a touch input source (such as a finger or stylus) detected by the touchscreen or touch sensor contacts the touchscreen. In some embodiments, a touch event can include at least one of the following: a touch down sub-event, a touch move sub-event, a touch end sub-event, or a touch cancel sub-event. For a touch down sub-event, the terminal device 110 can trigger the touch down sub-event in response to detecting contact between a touch input source and the touchscreen. For a touch move sub-event, the terminal device 110 can continuously trigger the touch move sub-event in response to detecting continuous movement of one or more touch points on the touchscreen. For a touch end sub-event, the terminal device 110 can trigger the touch end sub-event in response to detecting that the touch input source has disengaged from the touchscreen. For a touch cancel sub-event, the terminal device 110 can trigger the touch cancel sub-event in response to the touch being interrupted rather than ending normally (e.g., due to touch interruption caused by other system events). In some embodiments, the terminal device 110 may, in response to detecting a touch start sub-event on the user interface, determine at least one candidate view node associated with the touch start sub-event from a plurality of view nodes of the user interface.
[0036] Each of the at least one candidate view node has a corresponding predetermined gesture. In some embodiments, the predetermined gesture may include at least one of the following: a tap gesture, a long press gesture, a pan gesture, or a fling gesture. A tap gesture refers to a gesture in which the touch input source makes brief contact with the touchscreen (e.g., the contact time does not exceed a first time threshold). A long press gesture refers to a gesture in which the touch input source makes prolonged contact with the touchscreen (e.g., the contact time exceeds a second time threshold) and no movement occurs (e.g., the distance between the position of the touch start sub-event and the position of the touch end sub-event is less than a displacement threshold). The first time threshold and the second time threshold may be the same, or the second time threshold may be greater than the first time threshold. A pan gesture is a continuous gesture that can identify the dragging behavior of the touch input source on the screen. The terminal device 110 may determine that a pan gesture has been detected in response to the touch input source continuously contacting the touchscreen and the touch input source moving a first predetermined distance. For a fling gesture, the terminal device 110 may determine that a fling gesture has been detected in response to the touch input source moving a second predetermined distance on the touchscreen and the movement speed of the touch input source when it leaves the touchscreen being greater than a speed threshold. In some embodiments, candidate view nodes may be bound to an event recognizer, which may be configured to recognize a predetermined gesture of the bound view node based on a touch event.
[0037] In some embodiments, the view nodes associated with a touch event may include view nodes that are positionally related to and have execution logic related to the touch event. In some embodiments, the terminal device 110 may, in response to detecting a touch event on the user interface, determine a view node selected by the touch event and a view hierarchy of multiple view nodes. Then, the terminal device 110 may determine at least one candidate view node based on the position of the view node selected by the touch event in the view hierarchy. For example, the terminal device 110 may, in response to detecting a touch start sub-event, determine the touch position of the touch start sub-event. Based on the touch position, the view node selected by the touch start sub-event is determined. The terminal device 110 may also obtain the execution scripts of multiple view nodes of the user interface, and, based on the execution scripts of the multiple view nodes, determine a view hierarchy of multiple view nodes. Then, the terminal device 110 may, based on the position of the view node selected by the touch start sub-event in the view hierarchy, determine at least one candidate view node associated with the touch start sub-event. For example, the terminal device 110 may determine the path in the view hierarchy from the view node selected by the touch start sub-event to the root node of the view hierarchy. View nodes located on this path and bound to an event recognizer are identified as at least one candidate view node associated with the touch event.
[0038] In some embodiments, the event recognizer may have at least one of the following states: undefined state, start state, active state, failure state, or end state. The undefined state may be the initial state of the event recognizer. The undefined state indicates that the event recognizer has not performed a predetermined gesture recognition. The start state indicates that the event recognizer is performing gesture recognition, but does not indicate success or failure. The active state indicates that the event recognizer has recognized a predetermined gesture, and the event recognizer performs an operation corresponding to the predetermined gesture in response to recognizing a predetermined finger, such as performing an operation corresponding to the predetermined gesture via a callback in response to recognizing a predetermined gesture based on a touch event. The failure state indicates that the event recognizer failed to recognize the predetermined gesture. An event recognizer in the failure state may have previously been in the active state but has now switched to the failure state, for example, recognizing a drag gesture based on a touch event, but the current touch input source has detached from the touchscreen, at which point the touch event switches to the failure state. The end state indicates that the processing and response to the touch event has ended. It should be noted that the state of the event recognizer here can also be referred to as the state of the predetermined gesture corresponding to the event recognizer.
[0039] In block 220 of process 200, terminal device 110 determines the response relationship of at least one candidate view node to a touch event based on the association relationship between at least one candidate view node. The response relationship of the at least one candidate view node to the touch event may include, but is not limited to, the transmission relationship, cooperation relationship, waiting relationship, succession relationship, and competition relationship of the at least one candidate view node to the touch event, etc.
[0040] In some embodiments, the terminal device 110 can determine the hierarchical relationship between at least one candidate view node based on the view hierarchy of multiple view nodes. The terminal device 110 can determine a response relationship based on the hierarchical relationship between the at least one candidate view node. Alternatively or additionally, the transmission relationship of the at least one candidate view node in a predetermined direction of the view hierarchy can be determined as the response relationship of the at least one candidate view node to a touch event. The predetermined direction can be the direction from the view node selected by the touch event to the root node of the view hierarchy.
[0041] As an example, the table below shows an example of a user interface's Document Object Model (DOM).
[0042] Table 1
[0043] As shown in the table above, the DOM structure includes three view nodes: a list "list", a scroll view "scroll-view", and an inner view "view-inner". Each of these three view nodes is bound to an event recognizer "panA", an event recognizer "panB", and an event recognizer "panC", respectively. The hierarchical relationship of these three view nodes is as follows: the list "list" is the innermost node, the scroll view "scroll-view" is the parent node of the list "list", and the inner view "view-inner" is the root node. Based on this, the terminal device 110 can determine that the response relationship of these three view nodes to touch events is that the list "list", the scroll view "scroll-view", and the inner view "view-inner" respond to touch events in that order.
[0044] In some embodiments, the terminal device 110 may acquire at least one execution script corresponding to at least one candidate view node. The execution script includes an event recognizer for the corresponding candidate view node, configured to recognize a predetermined gesture of the candidate view node based on a touch event. The terminal device 110 may determine the response relationship of at least one candidate view node to a touch event based on the interaction relationship between the respective event recognizers of the at least one candidate view node. Additionally, the interaction relationship between the event recognizers of the at least one candidate view node may include, but is not limited to, cooperative relationships, waiting relationships, successive relationships, and competitive relationships. Cooperative relationships may include cooperative relationships between multiple event recognizers of the same view node and cooperative relationships between event recognizers of different view nodes.
[0045] Multiple event recognizers located on the same view node and having a collaborative relationship can be active simultaneously; that is, the activation of one event recognizer will not cause another event recognizer to switch to a failed state. As an example, the system relationship between multiple event recognizers on the same view node will be exemplarily described below with reference to Figures 3A to 3C. Figures 3A to 3C illustrate schematic diagrams of user interfaces 300A to 300C according to some embodiments of this disclosure. In the user interfaces of Examples 300A to 300C, a view node 301 and a touch input source 302 (e.g., a finger) are shown. The view node 301 can be bound to an event recognizer that recognizes long-press gestures and an event recognizer that recognizes drag gestures, and these two event recognizers can be configured to have a collaborative relationship. When the touch input source 302 long-presses the view node 301, the event recognizer that recognizes the long-press gesture detects the long-press gesture based on the touch event and switches to an active state, for example, switching from the state shown in Example 300A to the state shown in Example 300B. If the touch input source 302 remains in contact with the touchscreen and moves relative to the touchscreen, the event recognizer for drag gestures detects the drag gesture and switches to the active state, without causing the event recognizer for long press gestures to switch to the failure state. As the touch input source 302 moves, the view node 301 moves accordingly.
[0046] Multiple event recognizers located on the same view node and used to recognize different predetermined gestures can have a competitive relationship. When one event recognizer switches to an active state, it prevents the other event recognizers from switching to an active state, causing the remaining event recognizers to fail. As an example, as shown in Figures 3A, 3B, and 3D, view node 301 can be bound to an event recognizer that recognizes long-press gestures and an event recognizer that recognizes drag gestures, and the two event recognizers can be configured to have a competitive relationship. When touch input source 302 long-presses view node 301, the event recognizer that recognizes long-press gestures recognizes the long-press gesture based on the touch event and switches to an active state, for example, switching from the state shown in Example 300A to the state shown in Example 300B. If touch input source 302 remains in contact with the touchscreen and moves relative to the touchscreen, the event recognizer that recognizes drag gestures, although able to recognize the drag gesture, will fail due to the competitive relationship, and view object 301 will not move with the movement of touch input source 302.
[0047] Multiple event recognizers located in different view nodes and used to recognize the same predetermined gesture can have a one-way collaborative relationship. In this relationship, the preceding event recognizer in the collaborative direction will move to a different state than the following event recognizer in the same direction, but the following event recognizer will not synchronize its state with the preceding event recognizer in the same direction. In other words, multiple event recognizers with a collaborative relationship will synchronize their states along the collaborative direction, but will not synchronize their states in the opposite direction.
[0048] As examples, Figures 4A to 4C respectively illustrate schematic diagrams of example 400A to 400C of user interfaces according to some embodiments of the present disclosure. In examples 400A to 400C, view nodes 401, 402, and 403 and a touch input source 404 (e.g., a finger) are shown. The event recognizers of view nodes 401, 402, and 403 are all used to recognize drag gestures, and the event recognizer of view node 401 has a one-way collaborative relationship with the event recognizers of view nodes 402 and 403. Specifically, the event recognizer of view node 401 is configured to synchronize its state with the event recognizers of view nodes 402 and 403, but the event recognizer of view node 403 does not synchronize its state with the event recognizer of view node 401. Based on this, when touch input source 404 drags view node 401, the event recognizer of view node 401 detects the drag gesture and switches to the active state, synchronizing its state with the event recognizers of view nodes 402 and 403, causing view nodes 401, 402, and 403 to move synchronously. However, when touch input source 404 drags view node 403, the event recognizer of view node 403 detects the drag gesture, but the event recognizer of view node 403 does not synchronize its state with the event recognizers of view nodes 401 and 402, so only view node 403 itself moves.
[0049] If event recognizers of view nodes with nested relationships are used to recognize the same predetermined gesture, these event recognizers may have a waiting relationship. Event recognizers with waiting relationships will recognize predetermined gestures in the order indicated by the waiting relationship, and will perform a corresponding predetermined operation after recognizing the predetermined gesture. As an example, Figures 5A to 5C respectively show schematic diagrams of example 500A to 500C of user interfaces according to some embodiments of the present disclosure. View nodes 501, 502 and touch input source 503 are shown in the user interface of example 500A to example 500C. View node 501 may be an outer container and view node 502 may be an inner container, and view nodes 501 and 502 have a nested relationship. The event recognizers of view nodes 501 and 502 are both used to recognize drag gestures. The event recognizer of view node 502 can be configured to wait for the event recognizer of view node 501. When the touch input source 503 drags the user interface, both the event recognizers of view node 501 and view node 502 are able to recognize the drag gesture. However, only the event recognizer of view node 501 switches to the active state; the event recognizer of view node 502 does not switch to the active state. At this time, view node 501 responds to the detected drag gesture and moves upwards, as shown in Figures 5A and 5B. When view node 501 moves to the top of the user interface, the event recognizer of view node 501 switches to the failed state. The event recognizer of view node 502 switches to the active state, and view node 502 moves upwards, as shown in Figures 5B and 5C.
[0050] Event recognizers located on different view nodes and used to recognize the same predetermined gesture can have a successive relationship. These view nodes can be nested or parallel. Event recognizers with a successive relationship can respond sequentially to the same recognized predetermined gesture. As an example, Figures 6A to 6C respectively show schematic diagrams of user interfaces 600A to 600C according to some embodiments of the present disclosure. View nodes 601, 602 and touch input source 603 are shown in the user interface of examples 600A to 600C. The event recognizers of view node 601 and view node 602 can have a successive relationship. When touch input source 603 drags view node 601, the event recognizer of view node 601 can recognize the drag gesture, and view node 601 moves upward, as shown in Figures 6A to 6B. When view node 601 moves to the bottom, the event recognizer of view node 601 switches to a failure state. The event recognizer of view node 601 passes the drag gesture to the event recognizer of view node 602. The event recognizer of view node 602 takes over the response to the drag gesture from the event recognizer of view node 601, and view node 602 moves upward, as shown in Figures 6B to 6C.
[0051] It is understood that the above-described interaction relationships are merely exemplary. In practical applications, any appropriate relationship can be configured between the event recognizers of the view nodes according to actual needs. The embodiments of this disclosure do not impose specific limitations in this regard.
[0052] To illustrate how the terminal device 110 determines the response relationship of the at least one candidate view node to touch events based on the interaction relationship between the respective event recognizers of the at least one candidate view node, an example of script execution for another part of the user interface is shown based on the DOM structure shown in Table 1.
[0053] Table 2
[0054] As shown in the table above, there is a waiting relationship between event recognizer "panA" and event recognizer "panB", and a cooperative relationship between event recognizer "panB" and event recognizer "panC". Based on this, the response relationship of the three view nodes "list", "scroll-view", and "view-inner" to touch events is as follows: "scroll-view" and "view-inner" respond to touch events first based on their cooperative relationship, and then "list" responds to touch events based on their waiting relationship.
[0055] In block 230 of process 200, terminal device 110 identifies a predetermined gesture corresponding to a candidate view node among at least one candidate view node based on a touch event, according to a response relationship. In some embodiments, terminal device 110 can generate a response flow graph indicating the response relationship based on the response relationship. Based on the response flow graph, touch events are assigned to a first view node among at least one candidate view node. A first predetermined gesture corresponding to the first view node is identified based on the touch event through the first view node.
[0056] In some embodiments, the event recognizer includes determination conditions for a predetermined gesture for an associated candidate view node. These determination conditions can vary depending on the predetermined gesture. For example, if the predetermined gesture is a click gesture, the determination conditions may include that the contact time between the touch input source and the touchscreen does not exceed a first time threshold. As another example, if the predetermined gesture is a long press gesture, the determination conditions may include that the contact time between the touch input source and the touchscreen exceeds a second event threshold, and the distance between the position of the touch start sub-event and the position of the touch end sub-event is less than a displacement threshold. It is understood that the above determination conditions are merely exemplary. In practical applications, any appropriate conditions can be selected according to actual needs. The embodiments of this disclosure do not limit this.
[0057] Terminal device 110 can assign touch events to a first event recognizer associated with a first view node among at least one candidate view node, based on response relationships. Then, terminal device 110 can recognize a first predetermined gesture of the first view node based on the determining conditions included in the first event recognizer and the touch event.
[0058] In the example shown in Table 1, the response relationship of the three view nodes "list", "scroll-view", and "view-inner" to touch events is as follows: "list", "scroll-view", and "view-inner" respond to touch events in sequence. Based on this, a response flow graph 700 as shown in Figure 7 can be generated. In the response flow graph 700, box 710 indicates "list", box 720 indicates "scroll-view", and box 730 indicates "view-inner". Based on the response flow graph 700, the terminal device 110 first assigns the touch event to the event recognizer "panA" of the list "list". The event recognizer "panA" can include the determination conditions for drag gestures, and the event recognizer "panA" can recognize drag gestures based on the determination conditions for drag gestures and touch events.
[0059] In the example shown in Table 2, the response relationship of the three view nodes "list", "scroll-view", and "view-inner" to touch events is as follows: "scroll-view" and "view-inner" respond to touch events first based on a collaborative relationship, and then "list" responds to touch events based on a waiting relationship. Based on this, a response flow graph 800 as shown in Figure 8 can be generated. In the response flow graph 800, box 810 indicates the "scroll-view", box 820 indicates the "view-inner", and box 830 indicates the "list". Based on the response flow graph 800, the terminal device 110 first assigns the touch event to the event recognizer "panB" of the "scroll-view". The event recognizer "panB" can include the determination conditions for drag gestures, and can recognize drag gestures based on the determination conditions and the touch event.
[0060] In some embodiments, in response to the failure to recognize a first predetermined gesture based on a touch event by a first view node, the terminal device 110 assigns the touch event to a second view node following the first view node according to a response relationship. Then, the second view node recognizes a second predetermined gesture corresponding to the second view node based on the touch event. Additionally, the terminal device 110 can assign the touch event to a second view node following the first view node according to a response flow graph, and recognize a second predetermined gesture corresponding to the second view node based on the touch event.
[0061] In some embodiments, the terminal device 110 may determine the first event recognizer as in a failed state in response to the first event recognizer failing to recognize a first predetermined gesture based on a touch event. In response to the first event recognizer being in a failed state, the touch event is assigned to a second event recognizer of a second view node following the first view node according to a response relationship. Subsequently, the terminal device 110 may recognize a second predetermined gesture of the second view node based on the determination conditions included in the second event recognizer and the touch event.
[0062] In block 240 of process 200, terminal device 110, in response to recognizing a corresponding predetermined gesture for a target view node among at least one candidate view node, performs a corresponding target operation based on a touch event through the target view node. In some embodiments, terminal device 110 may determine the event recognizer of the target view node to be active in response to recognizing a corresponding predetermined gesture through the target view node. In response to the event recognizer of the target view node being active, the corresponding target operation is performed through the target view node based on a touch event. For example, if a first predetermined gesture is recognized through a first event recognizer of a first view node, terminal device 110 may determine the first event recognizer to be active. Then, terminal device 110 may perform a corresponding target operation through the first view node based on a touch event in response to the first event recognizer being active.
[0063] As an example, in Example 700, if the event recognizer "panA" of the list "list" detects a drag gesture, the terminal device 110 determines that the event recognizer "panA" is active. Then, the terminal device 110 can control the scrolling of the list "list" based on the drag gesture.
[0064] As another example, in Example 800, if the event recognizer "panB" of the scroll view "scroll-view" detects a drag gesture, the terminal device 110 determines that the event recognizer "panB" is active. Then, the terminal device 110 can control the scroll view "scroll-view" to scroll based on the drag gesture.
[0065] It is understood that the above operations are merely exemplary. In practical applications, the terminal device 110 may also perform any appropriate operations as needed, and the embodiments of this disclosure do not limit this.
[0066] In this manner, embodiments of this disclosure allocate touch events to view nodes based on the response relationships between view nodes in the user interface. This ensures that each view node can perform gesture recognition and gesture response according to the response relationships, thereby avoiding gesture conflicts. Furthermore, embodiments of this disclosure do not rely on the operating system for processing and allocating touch events. For the same application, even when deployed on different operating systems, consistency in interaction methods can be achieved.
[0067] Example devices and equipment
[0068] Embodiments of this disclosure also provide corresponding apparatus for implementing the methods or processes described above. FIG9 shows a schematic structural block diagram of an example apparatus 900 for touch event processing according to certain embodiments of this disclosure. Apparatus 900 may be implemented as or included in terminal device 110. The various modules / components in apparatus 400 may be implemented by hardware, software, firmware, or any combination thereof.
[0069] As shown in Figure 9, the device 900 includes: a response module 910 configured to, in response to detecting a touch event on the user interface, determine at least one candidate view node associated with the touch event from a plurality of view nodes of the user interface, wherein each candidate view node has a corresponding predetermined gesture; a determination module 920 configured to, based on the association relationship between the at least one candidate view node, determine the response relationship of the at least one candidate view node to the touch event; an identification module 930 configured to, based on the response relationship, identify the corresponding predetermined gesture for the candidate view node among the at least one candidate view node based on the touch event; and an execution module 940 configured to, in response to the identification of the corresponding predetermined gesture for the target view node among the at least one candidate view node, perform the corresponding target operation based on the touch event through the target view node.
[0070] In some embodiments, the response module 910 is further configured to: in response to detecting a touch event on the user interface, determine the view node selected by the touch event and the view hierarchy of multiple view nodes; and determine at least one candidate view node based on the position of the view node selected by the touch event in the view hierarchy.
[0071] In some embodiments, the determining module 920 is further configured to: determine a hierarchical relationship between at least one candidate view node based on the view hierarchy structure of the plurality of view nodes; and determine a response relationship based on the hierarchical relationship between at least one candidate view node.
[0072] In some embodiments, the determining module 920 is further configured to: obtain at least one execution script corresponding to at least one candidate view node, wherein the execution script in the at least one execution script includes an event recognizer of the corresponding candidate view node, the event recognizer being configured to recognize a predetermined gesture of the corresponding candidate view node based on a touch event; and determine the response relationship of at least one candidate view node to a touch event based on the interaction relationship between the event recognizers of the at least one candidate view node.
[0073] In some embodiments, the recognition module 930 is further configured to: generate a response flow graph indicating the response relationship based on the response relationship; assign a touch event to a first view node among at least one candidate view node based on the response flow graph; and recognize a first predetermined gesture corresponding to the first view node based on the touch event through the first view node.
[0074] In some embodiments, the recognition module 930 is further configured to: in response to the failure to recognize a first predetermined gesture based on a touch event through a first view node, assign the touch event to a second view node following the first view node according to a response flow graph; and recognize a second predetermined gesture corresponding to the second view node based on the touch event through the second view node.
[0075] In some embodiments, at least one candidate view node is associated with an event recognizer, the event recognizer including determination conditions for a predetermined gesture for the associated candidate view node, and the recognition module 930 is further configured to: assign a touch event to a first event recognizer associated with a first view node among at least one candidate view node according to a response relationship; and recognize a first predetermined gesture of the first view node according to the determination conditions included in the first event recognizer and the touch event.
[0076] In some embodiments, the recognition module 930 is further configured to: determine the first event recognizer as in a failure state in response to the first event recognizer failing to recognize the first predetermined gesture based on the touch event; assign the touch event to the second event recognizer of the second view node following the first view node according to the response relationship in response to the first event recognizer being in a failure state; and recognize the second predetermined gesture of the second view node according to the determination conditions included in the second event recognizer and the touch event.
[0077] In some embodiments, the execution module 940 is further configured to: determine the first event recognizer as active in response to the recognition of a first predetermined gesture by the first event recognizer of the first view node; and perform a corresponding target operation based on the touch event by the first view node in response to the first event recognizer being active.
[0078] In some embodiments, a touch event includes at least one of the following: a touch start sub-event, a touch move sub-event, a touch end sub-event, or a touch cancel sub-event.
[0079] The units and / or modules included in device 900 can be implemented in various ways, including software, hardware, firmware, or any combination thereof. In some embodiments, one or more units and / or modules can be implemented using software and / or firmware, such as machine-executable instructions stored on a storage medium. In addition to or as an alternative to machine-executable instructions, some or all of the units and / or modules in device 900 can be implemented at least partially by one or more hardware logic components. By way of example and not limitation, exemplary types of hardware logic components that can be used include field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), complex programmable logic devices (CPLDs), and so on.
[0080] Figure 10 illustrates a block diagram of an electronic device 1000 in which one or more embodiments of the present disclosure may be implemented. It should be understood that the electronic device 1000 shown in Figure 10 is merely exemplary and should not constitute any limitation on the functionality and scope of the embodiments described herein. The electronic device 1000 shown in Figure 10 may include or be implemented as the terminal device 110 of Figure 1, or the device 900 of Figure 9.
[0081] As shown in Figure 10, the electronic device 1000 is in the form of a general-purpose electronic device. Components of the electronic device 1000 may include, but are not limited to, one or more processors or processing units 1010, memory 1020, storage device 1030, one or more communication units 1040, one or more input devices 1050, and one or more output devices 1060. The processor 1010 may be a physical or virtual processor and is capable of performing various processes according to computer-executable instructions stored in memory 1020. In a multiprocessor system, multiple processors execute computer-executable instructions in parallel to improve the parallel processing capability of the electronic device 1000.
[0082] Electronic device 1000 typically includes multiple computer storage media. Such media can be any accessible media that is accessible to electronic device 1000, including but not limited to volatile and non-volatile media, removable and non-removable media. Memory 1020 can be volatile memory (e.g., registers, cache, random access memory (RAM)), non-volatile memory (e.g., read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory), or some combination thereof. Storage device 1030 can be removable or non-removable media and may include machine-readable media, such as flash drives, disks, or any other media that can be used to store information and / or data and can be accessed within electronic device 1000.
[0083] Electronic device 1000 may further include additional removable / non-removable, volatile / non-volatile storage media. Although not shown in FIG. 10, disk drives for reading from or writing to removable, non-volatile disks (e.g., "floppy disks") and optical disk drives for reading from or writing to removable, non-volatile optical disks may be provided. In these cases, each drive may be connected to a bus (not shown) via one or more data media interfaces. Memory 1020 may include computer program product 1025 having one or more program modules configured to perform various methods or actions of various embodiments of this disclosure.
[0084] The communication unit 1040 enables communication with other electronic devices via a communication medium. Additionally, the functionality of the components of the electronic device 1000 can be implemented using a single computing cluster or multiple computing machines capable of communicating via communication connections. Therefore, the electronic device 1000 can operate in a networked environment using logical connections to one or more other servers, network personal computers (PCs), or another network node.
[0085] Input device 1050 can be one or more input devices, such as a mouse, keyboard, trackball, etc. Output device 1060 can be one or more output devices, such as a monitor, speaker, printer, etc. Electronic device 1000 can also communicate with one or more external devices (not shown) via communication unit 1040 as needed. These external devices include storage devices, display devices, etc., and can communicate with one or more devices that enable user interaction with electronic device 1000, or with any device that enables electronic device 1000 to communicate with one or more other electronic devices (e.g., network card, modem, etc.). Such communication can be performed via input / output (I / O) interface (not shown).
[0086] According to an exemplary implementation of this disclosure, a computer-readable storage medium is provided that stores computer-executable instructions thereon, wherein the computer-executable instructions are executed by a processor to implement the methods described above. According to an exemplary implementation of this disclosure, a computer program product is also provided, which is tangibly stored on a non-transitory computer-readable medium and includes computer-executable instructions, which are executed by a processor to implement the methods described above.
[0087] Various aspects of this disclosure are described herein with reference to flowchart illustrations and / or block diagrams of methods, apparatuses, devices, and computer program products implemented according to this disclosure. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer-executable instructions.
[0088] These computer-executable instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that, when executed by the processor of the computer or other programmable data processing apparatus, they create means for implementing the functions / actions specified in one or more blocks of the flowchart and / or block diagram. These computer-executable instructions can also be stored in a computer-readable storage medium that causes a computer, programmable data processing apparatus, and / or other device to operate in a particular manner; thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing aspects of the functions / actions specified in one or more blocks of the flowchart and / or block diagram.
[0089] Computer-executable instructions can be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions that execute on the computer, other programmable data processing apparatus, or other device to perform the functions / actions specified in one or more boxes of a flowchart and / or block diagram.
[0090] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of an instruction, which contains one or more executable instructions for implementing the specified logical function. In some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0091] Various implementations of this disclosure have been described above. These descriptions are exemplary and not exhaustive, nor are they limited to the disclosed implementations. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described implementations. The terminology used herein is chosen to best explain the principles, practical applications, or improvements to technology in the market, or to enable others skilled in the art to understand the various implementations disclosed herein.
Claims
1. A touch event handling method, comprising: In response to the detection of a touch event on the user interface, at least one candidate view node associated with the touch event is determined from a plurality of view nodes of the user interface, each of the at least one candidate view node having a corresponding predetermined gesture; Based on the association between the at least one candidate view node, determine the response relationship of the at least one candidate view node to the touch event; Based on the response relationship, a predetermined gesture is identified for the candidate view node among the at least one candidate view node based on the touch event; as well as In response to the recognition of a corresponding predetermined gesture for a target view node among the at least one candidate view nodes, a corresponding target operation is performed based on the touch event through the target view node.
2. The method of claim 1, wherein determining at least one candidate view node associated with the touch event from a plurality of view nodes of the user interface comprises: In response to detecting a touch event on the user interface, the view node selected by the touch event and the view hierarchy of the plurality of view nodes are determined; as well as Based on the position of the view node selected by the touch event in the view hierarchy, at least one candidate view node is determined.
3. The method according to claim 1, wherein determining the response relationship of the at least one candidate view node to the touch event comprises: Based on the view hierarchy structure of the plurality of view nodes, determine the hierarchical relationship between the at least one candidate view node; as well as The response relationship is determined based on the hierarchical relationship between the at least one candidate view node.
4. The method of claim 1, wherein determining the response relationship of the at least one candidate view node to the touch event comprises: At least one execution script corresponding to the at least one candidate view node is obtained, wherein the execution script includes an event recognizer for the corresponding candidate view node, and the event recognizer is configured to recognize a predetermined gesture of the corresponding candidate view node based on a touch event. as well as Based on the interaction relationship between the event recognizers of the at least one candidate view node, the response relationship of the at least one candidate view node to the touch event is determined.
5. The method according to claim 1, wherein identifying a corresponding predetermined gesture for a candidate view node among the at least one candidate view node comprises: Based on the response relationships, a response flow graph indicating the response relationships is generated; Based on the response flow graph, the touch event is assigned to the first view node among the at least one candidate view nodes; as well as The first view node identifies a first predetermined gesture corresponding to the first view node based on the touch event.
6. The method of claim 5, wherein identifying a predetermined gesture corresponding to a candidate view node among the at least one candidate view node further comprises: In response to the first view node not recognizing the first predetermined gesture based on the touch event, the touch event is assigned to a second view node following the first view node according to the response flow graph; as well as The second view node identifies a second predetermined gesture corresponding to the second view node based on the touch event.
7. The method of claim 1, wherein each of the at least one candidate view node is associated with an event recognizer, the event recognizer including determination conditions for a predetermined gesture of the associated candidate view node, and The predetermined gesture for recognizing the corresponding candidate view node among the at least one candidate view node includes: Based on the response relationship, the touch event is assigned to the first event recognizer associated with the first view node among the at least one candidate view nodes; as well as Based on the determining conditions included in the first event recognizer and the touch event, a first predetermined gesture of the first view node is recognized.
8. The method of claim 7, wherein identifying a predetermined gesture corresponding to a candidate view node among the at least one candidate view node further comprises: In response to the first event recognizer failing to recognize the first predetermined gesture based on the touch event, the first event recognizer is determined to be in a failed state; In response to the first event recognizer being in the failure state, the touch event is assigned to the second event recognizer of the second view node following the first view node according to the response relationship; as well as Based on the determining conditions included in the second event recognizer and the touch event, a second predetermined gesture of the second view node is recognized.
9. The method according to claim 7, wherein performing the corresponding target operation based on the touch event comprises: In response to the first predetermined gesture being recognized by the first event recognizer of the first view node, the first event recognizer is determined to be in an active state; as well as In response to the first event recognizer being active, the first view node performs the corresponding target operation based on the touch event.
10. The method of claim 1, wherein the touch event comprises at least one of the following: Touch start child event, Touch move sub-event, Touch end child event, or Touch cancel sub-event.
11. An apparatus for handling touch events, comprising: The response module is configured to respond to the detection of a touch event on the user interface, and determine at least one candidate view node associated with the touch event from a plurality of view nodes of the user interface, wherein each of the at least one candidate view node has a corresponding predetermined gesture. The determination module is configured to determine the response relationship of the at least one candidate view node to the touch event based on the association relationship between the at least one candidate view node; The recognition module is configured to recognize a predetermined gesture corresponding to a candidate view node among the at least one candidate view nodes based on the response relationship and the touch event. as well as The execution module is configured to, in response to recognizing a corresponding predetermined gesture for a target view node among the at least one candidate view nodes, perform a corresponding target operation based on the touch event through the target view node.
12. An electronic device, comprising: At least one processor; as well as At least one memory, coupled to the at least one processor and storing instructions for execution by the at least one processor, which, when executed by the at least one processor, cause the electronic device to perform the method according to any one of claims 1 to 10.
13. A computer-readable storage medium having stored thereon computer-executable instructions that can be executed by a processor to implement the method according to any one of claims 1 to 10.
14. A computer program product comprising computer-executable instructions, wherein the computer-executable instructions, when executed by a processor, implement the method according to any one of claims 1 to 10.
Citation Information
Patent Citations
Interference elimination in gesture recognition system
CN103529976A
Event Recognition
CN104035717A
Method and device for processing gesture event, equipment and storage medium
CN115344121A
Touch event processing method and device, equipment and storage medium
CN119376608A
Electronic device and task configuring method of electronic device
US20150169163A1