Touch event processing method, device, equipment and storage medium

By determining the association and response relationships in the user interface view nodes, identifying and executing gesture operations of touch events, the problems of gesture conflicts and inconsistent interaction methods in traditional touch technology are solved, and a more accurate and consistent interaction experience is achieved.

CN119376608BActive Publication Date: 2025-10-03BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411515622.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-28
Publication Date
2025-10-03
Estimated Expiration
2044-10-28

AI Technical Summary

Technical Problem

Traditional touch technology is prone to conflicts when coordinating multiple gestures, affecting operation accuracy and interactive experience, and there are differences in interaction methods on different operating systems.

Method used

By responding to detected touch events, determining the association relationship of user interface view nodes, identifying predetermined gestures, and performing target operations based on the response relationship, gesture conflicts are avoided and a consistent interaction method is achieved.

Benefits of technology

Ensure that view nodes recognize and respond to gestures according to the response relationship to avoid gesture conflicts and achieve consistency in interaction methods on different operating systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119376608B_ABST
    Figure CN119376608B_ABST
Patent Text Reader

Abstract

Embodiments of the present disclosure provide a touch event processing method, apparatus, device, and storage medium. 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 multiple view nodes of the user interface, wherein the at least one candidate view node has a corresponding predetermined gesture; based on an association relationship between the at least one candidate view node, determining a response relationship of the at least one candidate view node to the touch event; based on the response relationship, identifying a corresponding predetermined gesture for a candidate view node in the at least one candidate view node based on the touch event; and in response to identifying a corresponding predetermined gesture for a target view node in the at least one candidate view node, performing a corresponding target operation based on the touch event through the target view node.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Example embodiments of the present disclosure generally relate to the field of computers, and more particularly, to a touch event processing method, apparatus, device, computer-readable storage medium, and computer program product. Background Art

[0002] With the development of computer technology, touchscreen technology has become widely used in various electronic devices. Touchscreens are not only found on various mobile devices, but also on display devices of various sizes, fixed terminals, and household appliances. Users can flexibly operate these electronic devices through a variety of gestures, such as tapping, long pressing, dragging, and inertial sliding. However, the performance of traditional touch technology in coordinating these various gestures still needs to be improved. Summary of the Invention

[0003] In a first aspect of the present 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 multiple view nodes of the user interface, wherein the at least one candidate view node has a corresponding predetermined gesture; based on an association relationship between the at least one candidate view node, determining a response relationship of the at least one candidate view node to the touch event; based on the response relationship, identifying a corresponding predetermined gesture for a candidate view node in the at least one candidate view node based on the touch event; and in response to identifying the corresponding predetermined gesture for a target view node in the at least one candidate view node, performing a corresponding target operation based on the touch event via the target view node.

[0004] In a second aspect of the present disclosure, a device for handling touch events is provided. The device 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 multiple view nodes of the user interface, wherein the at least one candidate view node has a corresponding predetermined gesture; a determination module configured to determine a response relationship of the at least one candidate view node to 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 in 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 in the at least one candidate view node, execute a corresponding target operation based on the touch event through the target view node.

[0005] In a third aspect of the present disclosure, an electronic device is provided. The device includes at least one processing unit; and at least one memory coupled to the at least one processing unit and storing instructions for execution by the at least one processing unit. When executed by the at least one processing unit, the instructions cause the device to perform the method of the first aspect.

[0006] In a fourth aspect of the present disclosure, a computer-readable storage medium is provided, wherein a computer program is stored on the computer-readable storage medium, and the computer program can be executed by a processor to implement the method of the first aspect.

[0007] In a fifth aspect of the present disclosure, a computer program product is provided, comprising a computer program, wherein when the computer program is executed by a processor, the method according to the first aspect of the present disclosure is implemented.

[0008] It should be understood that the content described in this summary section is not intended to limit the key features or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0009] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. In the accompanying drawings, the same or similar reference numerals represent the same or similar elements, wherein:

[0010] Figure 1 A schematic diagram illustrating an example environment in which embodiments according to the present disclosure may be implemented;

[0011] Figure 2 A flowchart showing a process of touch event processing according to some embodiments of the present disclosure is shown;

[0012] Figures 3A to 6C Schematic diagrams respectively showing examples of user interfaces according to some embodiments of the present disclosure;

[0013] Figure 7 and Figure 8 Schematic diagrams respectively showing examples of response flow graphs according to some embodiments of the present disclosure;

[0014] Figure 9 A schematic structural block diagram showing an example apparatus for touch event processing according to some embodiments of the present disclosure is shown; and

[0015] Figure 10 A block diagram of an electronic device capable of implementing various embodiments of the present disclosure is shown. DETAILED DESCRIPTION

[0016] The following describes embodiments of the present disclosure in more detail with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as limited to the embodiments described herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of protection of the present disclosure.

[0017] It should be noted that the titles of any section / subsection provided herein are not limiting. Various embodiments are described throughout this document, and any type of embodiment may be included under any section / subsection. Furthermore, the embodiments described in any section / subsection may be combined in any manner with any other embodiments described in the same section / subsection and / or in different sections / subsections.

[0018] In the description of the embodiments of the present disclosure, the term "including" and similar terms should be understood as open inclusion, that is, "including but not limited to". The term "based on" should be understood as "based at least in part 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 be included below. The terms "first", "second", etc. may refer to different or the same objects. Other explicit and implicit definitions may be included below.

[0019] The embodiments of the present disclosure may involve user data, data acquisition and / or use, etc. These aspects shall comply with the corresponding laws, regulations and relevant provisions. In the embodiments of the present disclosure, all data collection, acquisition, processing, processing, forwarding, use, etc. are carried out on the premise that the user is aware of and confirms them. Accordingly, when implementing the various embodiments of the present disclosure, the types, scope of use, and usage scenarios of the data or information that may be involved should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with the relevant laws and regulations. The specific notification and / or authorization method may vary according to the actual situation and application scenario, and the scope of the present disclosure is not limited in this respect.

[0020] If this specification and the solutions in the examples involve the processing of personal information, such processing will be done only with a legitimate basis (such as with the consent of the subject of personal information or as necessary for the performance of a contract) and only within the prescribed or agreed scope. A user's refusal to process personal information other than that required for basic functions will not affect the user's use of basic functions.

[0021] As mentioned above, with the development of computer technology, touch screen technology has been widely used in various electronic devices. Not only are various mobile terminal devices equipped with touch screens, but display devices of many sizes, fixed terminal devices, household appliances, etc. are also equipped with touch screens. Users can flexibly operate these electronic devices through various gestures such as clicking, long pressing, dragging, inertial sliding, etc. However, traditional touch technology, on the one hand, is prone to conflicts between multiple gestures in scenarios where multiple gestures are coordinated for interaction, affecting the accuracy of touch operations and the interactive experience. On the other hand, traditional touch technology relies on the operating system to process and distribute touch events. Since different operating systems have different logic for handling touch events, the same application interacts differently on different operating systems.

[0022] An embodiment of the present disclosure proposes an improved scheme for touch event processing. In this scheme, in response to detecting a touch event on a user interface, at least one candidate view node associated with the touch event is determined from multiple view nodes of the user interface. The at least one candidate view node respectively has a corresponding predetermined gesture. Based on the association relationship between the at least one candidate view node, the 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 a candidate view node in the at least one candidate view node based on the touch event. If the target view node in the at least one candidate view node recognizes the corresponding predetermined gesture, the corresponding target operation is performed based on the touch event through the target view node.

[0023] In this way, embodiments of the present disclosure distribute touch events to view nodes in the user interface based on their response relationships to touch events. This ensures that each view node can recognize and respond to gestures according to these response relationships, thus avoiding gesture conflicts. Furthermore, embodiments of the present disclosure do not rely on the operating system to process and distribute touch events. This allows consistent interaction with the same application, even when deployed on different operating systems.

[0024] Various example implementations of this solution are described in detail below in conjunction with the accompanying drawings.

[0025] Sample Environment

[0026] Figure 1 FIG2 is a schematic diagram of an example environment 100 in which embodiments of the present disclosure can be implemented. In the example environment 100 , an application 120 is installed in 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 .

[0027] In the embodiment of the present disclosure, the application 120 may be any appropriate application, and the embodiment of the present disclosure does not limit the functions of the application 120 and the service content provided. Figure 1 In the environment, if the application 120 is in an active state, the terminal device 110 may present an interface 150 of the application 120. The interface 150 may include various interfaces that the application 120 may provide.

[0028] In some embodiments, the terminal device 110 communicates with the server device 130 to enable the provision of services for the application 120. The terminal device 110 can be any type of mobile terminal, fixed terminal or portable terminal, including a mobile phone, a desktop computer, a laptop computer, a notebook computer, a netbook computer, a tablet computer, a media computer, a multimedia tablet, a personal communication system (PCS) device, a personal navigation device, a personal digital assistant (PDA), an audio / video player, a digital camera / camcorder, a positioning device, a television receiver, a radio broadcast receiver, an e-book device, a gaming device or any combination of the foregoing, including accessories and peripherals of these devices or any combination thereof. In some embodiments, the terminal device 110 can also support any type of interface for the user (such as "wearable" circuits, etc.). The server device 130 can be various types of computing systems / servers that can provide computing capabilities, including but not limited to mainframes, edge computing nodes, computing devices in cloud environments, and the like.

[0029] It should be understood that the structure and function of the various elements in the environment 100 are described for illustrative purposes only and do not imply any limitation on the scope of the present disclosure.

[0030] Some example embodiments of the present disclosure will be described below with continued reference to the accompanying drawings.

[0031] Example Process

[0032] Figure 2 FIG. 2 is a flow chart showing a process 200 of touch event processing according to some embodiments of the present disclosure. Figure 1 The embodiments of the present disclosure are described with reference to the environment 100 in FIG. 1 and the terminal device 110 in FIG. 1 , but this is merely exemplary. In some embodiments, the actions described with reference to the terminal device may be performed by the terminal device in coordination with the server.

[0033] In block 210 of process 200, in response to detecting a touch event on a user interface, the terminal device 110 determines at least one candidate view node associated with the touch event from a plurality of view nodes in the user interface. The user interface may be the interface 150 of an application 120 running on the terminal device 110, or may be another interface of the terminal device 110. A view node is a component unit or element of a user interface, and a user interface may include multiple view nodes. A view node may include visible elements in the user interface, such as options, buttons, text, images, and the like. A view node may also include invisible elements in the user interface, such as containers, frames, and the like.

[0034] A touch event may include an event in which a touch input source (e.g., a finger or stylus) contacts the touch screen as detected by the touch screen or touch sensor. In some embodiments, a touch event may 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 start sub-event, the terminal device 110 may trigger a touch start sub-event in response to detecting contact between the touch input source and the touch screen. For a touch move sub-event, the terminal device 110 may continuously trigger touch move sub-events in response to detecting that one or more touch points continue to move on the touch screen. For a touch end sub-event, the terminal device 110 may trigger a touch end sub-event in response to detecting that the touch input source is no longer in contact with the touch screen. For a touch cancel sub-event, the terminal device 110 may trigger a touch cancel sub-event in response to a touch being interrupted rather than ending normally (e.g., due to other system events). In some embodiments, in response to detecting a touch start sub-event on the user interface, the terminal device 110 may determine at least one candidate view node related to the touch start sub-event from a plurality of view nodes of the user interface.

[0035] Each of the at least one candidate view nodes has a corresponding predetermined gesture. In some embodiments, the predetermined gestures 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 briefly contacts the touch screen (e.g., the contact duration does not exceed a first time threshold). A long press gesture refers to a gesture in which the touch input source contacts the touch screen for a prolonged period of time (e.g., the contact duration exceeds a second time threshold) without movement (e.g., the distance between the location of the touch start sub-event and the location 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 fling gesture is a continuous gesture that can identify the dragging behavior of the touch input source on the screen. Terminal device 110 may determine that a drag gesture has been detected in response to the touch input source being in continuous contact with the touch screen and moving a first predetermined distance. For a fling gesture, 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 touch screen and the speed at which the touch input source loses contact with the touch screen being greater than a speed threshold. In some embodiments, a candidate view node can be bound to an event recognizer, and the event recognizer can be configured to recognize a predetermined gesture for the bound view node based on a touch event.

[0036] In some embodiments, the view nodes associated with a touch event may include view nodes that have both a positional correlation and an execution logic correlation with the touch event. In some embodiments, terminal device 110 may, in response to detecting a touch event on a user interface, determine the view node selected by the touch event and a view hierarchy of multiple view nodes. Terminal device 110 may then 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, terminal device 110 may, in response to detecting a touch start sub-event, determine the touch location of the touch start sub-event. Based on the touch location, the view node selected by the touch start sub-event is determined. Terminal device 110 may also obtain execution scripts for multiple view nodes in the user interface and, based on the execution scripts of the multiple view nodes, determine the view hierarchy of the multiple view nodes. Terminal device 110 may then determine at least one candidate view node associated with the touch start sub-event based on the position of the view node selected by the touch start sub-event in the view hierarchy. For example, 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. A view node located on the path and bound to an event recognizer is determined as at least one candidate view node related to the touch event.

[0037] In some embodiments, an event recognizer may have at least one of the following states: an undefined state, a start state, an active state, a failed state, or an end state. The undefined state may be the initial state of the event recognizer. The undefined state indicates that the event recognizer is not performing a predetermined gesture recognition. The start state indicates that the event recognizer is performing gesture recognition but does not indicate whether the gesture recognition succeeded or failed. The active state indicates that the event recognizer has recognized a predetermined gesture and, in response to recognizing a predetermined finger, performs an operation corresponding to the predetermined gesture. For example, in response to recognizing a predetermined gesture based on a touch event, the event recognizer performs an operation corresponding to the predetermined gesture through a callback. The failed state indicates that the event recognizer failed to recognize the predetermined gesture. An event recognizer in the failed state may have been in the active state but has now switched to the failed state. For example, if a drag gesture is recognized based on a touch event but the current touch input source has lost contact with the touch screen, the touch event switches to the failed 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.

[0038] At block 220 of process 200, terminal device 110 determines a 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, a transfer relationship, a collaboration relationship, a waiting relationship, a connection relationship, and a competition relationship of the at least one candidate view node to the touch event.

[0039] 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 the response relationship based on the hierarchical relationship between the at least one candidate view node. Alternatively or additionally, the transfer 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 the 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.

[0040] As an example, an example of a Document Object Model (DOM) of a user interface is shown in the following table.

[0041] Table 1

[0042]

[0043] As can be seen from the above table, the DOM structure includes three view nodes: list "list", scroll view "scroll-view" and inner view "view-inner", and the list "list", scroll view "scroll-view" and inner view "view-inner" are bound to event identifiers "panA", "panB" and "panC" respectively. The hierarchical relationship of these three view nodes is that the list "list" is in the innermost layer, the scroll view "scroll-view" is the parent node of the list "list", and the inner view "view-inner" is the root node. On this basis, the terminal device 110 can determine that the response relationship of the three view nodes to touch events includes the list "list", scroll view "scroll-view", and inner view "view-inner" responding to touch events in sequence.

[0044] In some embodiments, the terminal device 110 can obtain at least one execution script corresponding to at least one candidate view node. The execution script in the at least one execution script includes an event identifier of the corresponding candidate view node, and the event identifier is configured to identify a predetermined gesture of the corresponding candidate view node based on a touch event. The terminal device 110 can determine the response relationship of the at least one candidate view node to the touch event based on the interaction relationship between the respective event identifiers of the at least one candidate view node. Additionally, the interaction relationship between the event identifiers of the at least one candidate view node may include but is not limited to a collaborative relationship, a waiting relationship, a continuation relationship, a competitive relationship, and the like. The collaborative relationship may include a collaborative relationship between multiple event identifiers of the same view node and a collaborative relationship between event identifiers of different view nodes.

[0045] Multiple event recognizers on the same view node can be active at the same time. This means that one event recognizer being active will not cause another event recognizer to switch to a failed state. Figures 3A to 3C An exemplary introduction to the system relationship between multiple event recognizers of the same view node is given. Figures 3A to 3CSchematic diagrams of examples 300A to 300C of user interfaces according to some embodiments of the present disclosure are shown. 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 for recognizing a long press gesture and an event recognizer for recognizing a drag gesture, and the two event recognizers can be configured to have a collaborative relationship. The touch input source 302 long presses the view node 301, and the event recognizer for recognizing the long press gesture recognizes the long press gesture based on the touch event and switches to an activated 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 touch screen and moves relative to the touch screen, the event recognizer for recognizing the drag gesture recognizes the drag gesture and also switches to an activated state, and does not cause the event recognizer for recognizing the long press gesture to switch to a failed state. As the touch input source 302 moves, the view node 301 follows.

[0046] Multiple event recognizers located in the same view node and used to recognize different predetermined gestures can have a competitive relationship. Multiple event recognizers with a competitive relationship. If one event recognizer switches to an active state, it will exclude the remaining event recognizers from switching to an active state, causing the remaining event recognizers to be in a failed state. For example, if Figure 3A 、 Figure 3B and Figure 3D As shown, view node 301 can be bound to an event recognizer for recognizing a long press gesture and an event recognizer for recognizing a drag gesture, and the two event recognizers can be configured to have a competitive relationship. Touch input source 302 long-presses view node 301, and the event recognizer for recognizing a long press gesture recognizes the long press gesture based on the touch event and switches to an activated 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 touch screen and moves relative to the touch screen, although the event recognizer for recognizing a drag gesture can recognize the drag gesture, it is in a failed state due to the competitive relationship, and view node 301 will not move as touch input source 302 moves.

[0047] Multiple event recognizers located at different view nodes and used to recognize the same predetermined gesture can have a one-way collaborative relationship. For multiple event recognizers with a one-way recognition relationship, the previous event recognizer in the collaborative direction will have a different state from the next event recognizer in the collaborative direction, but the next event recognizer in the collaborative direction will not synchronize its state with the previous event recognizer in the collaborative direction. In other words, multiple event recognizers in a collaborative relationship will synchronize their states along the collaborative direction, but will not synchronize their states in the opposite direction of the collaborative direction.

[0048] As an example, Figures 4A to 4CSchematic diagrams of examples 400A to 400C of user interfaces according to some embodiments of the present disclosure are shown. Examples 400A to 400C illustrate view nodes 401, 402, and 403 and a touch input source 404 (e.g., a finger). The event recognizers of view nodes 401, 402, and 403 are all used to recognize a drag gesture, 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 switches to an active state after recognizing the drag gesture and synchronizes its state with the event recognizers of view nodes 402 and 403, resulting in the synchronous movement of view nodes 401, 402, and 403. However, when touch input source 404 drags view node 403, the event identifier of view node 403 recognizes the drag gesture, but the event identifier of view node 403 does not synchronize the state with the event identifiers of view nodes 401 and 402, so only view node 403 itself moves.

[0049] If the event recognizers of view nodes with nested inner and outer relationships are used to recognize the same predetermined gesture, these event recognizers can have a wait relationship. The event recognizers with a wait relationship will recognize the predetermined gesture in the order indicated by the wait relationship and perform the corresponding predetermined operation after recognizing the predetermined gesture. For example, Figures 5A to 5C Schematic diagrams of examples 500A to 500C of user interfaces according to some embodiments of the present disclosure are respectively shown. View nodes 501, 502 and touch input source 503 are shown in the user interfaces of examples 500A to 500C. View node 501 can be an outer container, view node 502 can be an inner container, and view nodes 501 and 502 have an inner-outer nested relationship. The event identifiers of view nodes 501 and 502 are both used to recognize drag gestures. The event identifier of view node 502 can be configured to wait for the event identifier of view node 501. When the touch input source 503 drags the user interface, the event identifier of view node 501 and the event identifier of view node 502 can both recognize the drag gesture. However, only the event identifier of view node 501 switches to an active state, and the event identifier of view node 502 does not switch to an active state. At this time, view node 501 moves upward in response to recognizing the drag gesture, as shown in FIG. Figures 5A to 5B As shown in FIG. 5 . 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 upward, as shown in FIG. Figures 5B to 5C shown.

[0050] Event recognizers located in different view nodes and used to recognize the same predetermined gesture can have a connection relationship. These view nodes can have a nested relationship or a parallel relationship. Event recognizers with a connection relationship can respond to the same predetermined gesture in a connection order. For example, Figures 6A to 6C Schematic diagrams of user interfaces according to some embodiments of the present disclosure are shown in Examples 600A to 600C. In the user interfaces of Examples 600A to 600C, view nodes 601 and 602 and a touch input source 603 are shown. The event recognizer of view node 601 and the event recognizer of view node 602 may have a connection 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 FIG. Figures 6A to 6B As shown. When view node 601 moves to the bottom, the event recognizer of view node 601 switches to the failed 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 event recognizer of view node 601 to respond to the drag gesture, and view node 602 moves upward, as shown. Figures 6B to 6C shown.

[0051] It is understandable that the above interaction relationship is merely exemplary, and in actual application, any appropriate relationship can be configured between the event identifiers of the view nodes according to actual needs. The embodiments of the present disclosure are not specifically limited in this regard.

[0052] To illustrate that terminal device 110 determines the response relationship of at least one candidate view node to a touch event based on the interaction relationship between the event identifiers of the at least one candidate view node, an example of executing a script in another part of the user interface is shown based on the DOM structure shown in Table 1.

[0053] Table 2

[0054]

[0055] As shown in the table above, event recognizers "panA" and "panB" have a wait relationship, while event recognizers "panB" and "panC" have a collaboration relationship. Based on this, the three view nodes (list, scroll-view, and view-inner) respond to touch events with the scroll-view and view-inner nodes taking priority due to their collaboration relationship, followed by the list node (list) due to its wait relationship.

[0056] At block 230 of process 200, terminal device 110 identifies a predetermined gesture corresponding to a candidate view node in at least one candidate view node based on the response relationship and the touch event. In some embodiments, terminal device 110 may generate a response flow graph indicating the response relationship based on the response relationship. Based on the response flow graph, the touch event is assigned to a first view node in the at least one candidate view node. A first predetermined gesture corresponding to the first view node is identified based on the touch event by the first view node.

[0057] In some embodiments, the event identifier includes a determination condition for a predetermined gesture of the associated candidate view node. The determination condition here may vary depending on the predetermined gesture. For example, in the case where the predetermined gesture is a click gesture, the determination condition may include that the contact time between the touch input source and the touch screen does not exceed a first time threshold. For another example, in the case where the predetermined gesture is a long press gesture, the determination condition may include that the contact time between the touch input source and the touch screen 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 will be understood that the above determination conditions are only exemplary. In actual application, any appropriate conditions can be selected according to actual needs. The embodiments of the present disclosure are not limited to this.

[0058] Terminal device 110 may assign the touch event to a first event recognizer associated with a first view node among the at least one candidate view node based on the response relationship. Terminal device 110 may then recognize a first predetermined gesture for the first view node based on the determination condition and the touch event included in the first event recognizer.

[0059] In the example shown in Table 1, the response relationship of the three view nodes, list "list", scroll view "scroll-view" and inner view "view-inner", to touch events includes the following: list "list", scroll view "scroll-view", inner view "view-inner" respond to touch events in sequence. Based on this, the following can be generated: Figure 7In response flow diagram 700, block 710 indicates list "list," block 720 indicates scroll view "scroll-view," and block 730 indicates inner view "view-inner." Based on response flow diagram 700, terminal device 110 first assigns a touch event to event recognizer "panA" of list "list." Event recognizer "panA" may include a condition for determining a drag gesture. Event recognizer "panA" may recognize a drag gesture based on the condition and the touch event.

[0060] In the example shown in Table 2, the response relationship of the three view nodes, list "list", scroll view "scroll-view" and inner view "view-inner", to touch events is that scroll view "scroll-view" and inner view "view-inner" respond to touch events first based on the collaborative relationship, and then list "list" responds to touch events based on the waiting relationship. On this basis, the following can be generated: Figure 8 Response flow diagram 800 is shown. In response flow diagram 800, block 810 indicates the scroll view "scroll-view", block 820 indicates the inner view "view-inner", and block 830 indicates the list "list". Based on response flow diagram 800, terminal device 110 first assigns the touch event to event recognizer "panB" of scroll view "scroll-view". Event recognizer "panB" may include a determination condition for a drag gesture. Event recognizer "panB" may recognize a drag gesture based on the determination condition for the drag gesture and the touch event.

[0061] In some embodiments, in response to the first view node failing to recognize the first predetermined gesture based on the touch event, terminal device 110 assigns the touch event to a second view node following the first view node based on the response relationship. Subsequently, the second view node recognizes a second predetermined gesture corresponding to the second view node based on the touch event. Additionally, terminal device 110 may assign the touch event to the second view node following the first view node based on the response flow graph, and recognize the second predetermined gesture corresponding to the second view node based on the touch event through the second view node.

[0062] In some embodiments, in response to the first event recognizer failing to recognize the first predetermined gesture based on the touch event, terminal device 110 may determine that the first event recognizer is in a failed state. In response to the first event recognizer being in the failed state, the touch event is assigned to a second event recognizer of a second view node subsequent to the first view node based on a response relationship. Terminal device 110 may then recognize a second predetermined gesture for the second view node based on the determination condition and touch event included in the second event recognizer.

[0063] In box 240 of process 200, the terminal device 110 performs a corresponding target operation based on a touch event through the target view node in response to recognizing a corresponding predetermined gesture for a target view node among at least one candidate view node. In some embodiments, the terminal device 110 may determine the event identifier of the target view node to be in an activated state in response to recognizing a corresponding predetermined gesture through the target view node. In response to the event identifier of the target view node being in an activated state, the corresponding target operation is performed based on a touch event through the target view node. For example, if a first predetermined gesture is recognized through a first event identifier of a first view node, the terminal device 110 may determine the first event identifier to be in an activated state. Thereafter, the terminal device 110 may perform a corresponding target operation based on a touch event through the first view node in response to the first event identifier being in an activated state.

[0064] For example, in example 700 , if event recognizer “panA” of the list “list” recognizes a drag gesture, terminal device 110 determines that event recognizer “panA” is active. Terminal device 110 can then control the scrolling of the list “list” according to the drag gesture.

[0065] As another example, in example 800 , if event recognizer "panB" of scroll view "scroll-view" recognizes a drag gesture, terminal device 110 determines that event recognizer "panB" is active. Terminal device 110 can then control scroll view "scroll-view" to scroll according to the drag gesture.

[0066] It is understandable that the above operations are merely exemplary. In actual applications, the terminal device 110 may also perform any appropriate operations according to actual needs, and the embodiments of the present disclosure do not limit this.

[0067] In this way, embodiments of the present disclosure distribute touch events to view nodes in the user interface based on their response relationships to touch events. This ensures that each view node can recognize and respond to gestures according to these response relationships, thus avoiding gesture conflicts. Furthermore, embodiments of the present disclosure do not rely on the operating system to process and distribute touch events. This allows consistent interaction with the same application, even when deployed on different operating systems.

[0068] Example devices and equipment

[0069] The embodiments of the present disclosure also provide corresponding devices for implementing the above methods or processes. Figure 91 shows a schematic structural block diagram of an example apparatus 900 for touch event processing according to some embodiments of the present disclosure. Apparatus 900 may be implemented as or included in terminal device 110. Each module / component in apparatus 400 may be implemented by hardware, software, firmware, or any combination thereof.

[0070] like Figure 9 As shown, 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 multiple view nodes of the user interface, at least one candidate view node respectively having a corresponding predetermined gesture; a determination module 920, configured to determine the response relationship of at least one candidate view node to the touch event based on the association relationship between at least one candidate view node; an identification module 930, configured to identify the corresponding predetermined gesture for a candidate view node in at least one candidate view node based on the touch event according to the response relationship; and an execution module 940, configured to, in response to identifying the corresponding predetermined gesture for a target view node in at least one candidate view node, perform a corresponding target operation based on the touch event through the target view node.

[0071] 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 structure 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 structure.

[0072] In some embodiments, the determination module 920 is further configured to: determine a hierarchical relationship between at least one candidate view node according to a view hierarchy structure of multiple view nodes; and determine a response relationship based on the hierarchical relationship between at least one candidate view node.

[0073] In some embodiments, the determination module 920 is further configured to: obtain at least one execution script corresponding to at least one candidate view node, the execution script in the at least one execution script includes an event identifier of the corresponding candidate view node, and the event identifier is configured to identify 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 the touch event based on the interaction relationship between the respective event identifiers of the at least one candidate view node.

[0074] In some embodiments, the identification module 930 is further configured to: generate a response flow graph indicating the response relationship based on the response relationship; assign the touch event to a first view node among at least one candidate view node based on the response flow graph; and identify a first predetermined gesture corresponding to the first view node based on the touch event through the first view node.

[0075] In some embodiments, the recognition module 930 is further configured to: in response to not recognizing the first predetermined gesture based on the touch event through the first view node, assign the touch event to a second view node following the first view node according to the response flow graph; and recognize, through the second view node, a second predetermined gesture corresponding to the second view node based on the touch event.

[0076] In some embodiments, at least one candidate view node is respectively associated with an event identifier, the event identifier includes a determination condition for a predetermined gesture of the associated candidate view node, and the recognition module 930 is further configured to: assign the touch event to a first event identifier associated with a first view node in at least one candidate view node based on a response relationship; and recognize a first predetermined gesture of the first view node based on the determination condition and touch event included in the first event identifier.

[0077] In some embodiments, the identification module 930 is further configured to: in response to the first event identifier not recognizing the first predetermined gesture based on the touch event, determine the first event identifier as a failure state; in response to the first event identifier being in a failure state, assign the touch event to a second event identifier of a second view node following the first view node according to a response relationship; and identify a second predetermined gesture of the second view node based on the determination condition and touch event included in the second event identifier.

[0078] In some embodiments, the execution module 940 is further configured to: in response to recognizing a first predetermined gesture through the first event identifier of the first view node, determine the first event identifier as an activated state; and in response to the first event identifier being in the activated state, perform a corresponding target operation based on the touch event through the first view node.

[0079] In some embodiments, the 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.

[0080] The units and / or modules included in the 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 the device 900 can be implemented at least in part by one or more hardware logic components. As an 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 chip (SOCs), complex programmable logic devices (CPLDs), and the like.

[0081] Figure 10 1 shows 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 Figure 10 The illustrated electronic device 1000 is merely exemplary and should not be construed as limiting the functionality and scope of the embodiments described herein. Figure 10 The electronic device 1000 shown may include or be implemented as Figure 1 terminal device 110, or Figure 9 device 900.

[0082] like Figure 10 As shown, electronic device 1000 is in the form of a general electronic device. Components of 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. Processing unit 1010 may be a real or virtual processor and is capable of performing various processes according to a program stored in memory 1020. In a multi-processor system, multiple processing units execute computer-executable instructions in parallel to increase the parallel processing capabilities of electronic device 1000.

[0083] The electronic device 1000 typically includes a plurality of computer storage media. Such media can be any accessible media that is accessible to the electronic device 1000, including but not limited to volatile and non-volatile media, removable and non-removable media. The memory 1020 can be a volatile memory (e.g., registers, cache, random access memory (RAM)), a non-volatile memory (e.g., read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory), or some combination thereof. The storage device 1030 can be a removable or non-removable medium and can include a machine-readable medium, such as a flash drive, a disk, or any other medium that can be used to store information and / or data and can be accessed within the electronic device 1000.

[0084] The electronic device 1000 may further include additional removable / non-removable, volatile / non-volatile storage media. Figure 10 As shown in FIG, a magnetic disk drive for reading from or writing to a removable, non-volatile magnetic disk (e.g., a "floppy disk") and an optical disk drive for reading from or writing to a removable, non-volatile optical disk may be provided. In these cases, each drive may be connected to a bus (not shown) by one or more data media interfaces. Memory 1020 may include a computer program product 1025 having one or more program modules configured to perform the various methods or actions of various embodiments of the present disclosure.

[0085] The communication unit 1040 enables communication with other electronic devices via a communication medium. Additionally, the functions of the components of the electronic device 1000 can be implemented as a single computing cluster or multiple computing machines that can communicate via a communication connection. Thus, the electronic device 1000 can operate in a networked environment using logical connections to one or more other servers, network personal computers (PCs), or other network nodes.

[0086] Input device 1050 may be one or more input devices, such as a mouse, keyboard, or trackball. Output device 1060 may be one or more output devices, such as a display, a speaker, or a printer. Electronic device 1000 may also communicate with one or more external devices (not shown) via communication unit 1040 as needed, such as storage devices, display devices, or the like, with one or more devices that allow a user to interact with electronic device 1000, or with any device that allows electronic device 1000 to communicate with one or more other electronic devices (e.g., a network card, a modem, etc.). Such communication may be performed via an input / output (I / O) interface (not shown).

[0087] According to an exemplary implementation of the present disclosure, a computer-readable storage medium is provided, on which computer-executable instructions are stored, wherein the computer-executable instructions are executed by a processor to implement the method described above. According to an exemplary implementation of the present disclosure, a computer program product is also provided, which is tangibly stored on a non-transitory computer-readable medium and includes computer-executable instructions, and the computer-executable instructions are executed by a processor to implement the method described above.

[0088] Various aspects of the present disclosure are described herein with reference to flowcharts and / or block diagrams of methods, apparatuses, devices, and computer program products implemented according to the present disclosure. It should be understood that each block of the flowcharts and / or block diagrams, and combinations of blocks in the flowcharts and / or block diagrams, can be implemented by computer-readable program instructions.

[0089] These computer-readable program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, such that when these instructions are executed by the processing unit of the computer or other programmable data processing device, a device is generated that implements the functions / actions specified in one or more blocks in the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium, where these instructions cause the computer, programmable data processing device, and / or other device to operate in a specific manner. Thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing various aspects of the functions / actions specified in one or more blocks in the flowchart and / or block diagram.

[0090] Computer-readable program instructions can be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operational steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more boxes in the flowchart and / or block diagram.

[0091] The flow charts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the systems, methods and computer program products according to multiple implementations of the present disclosure. In this regard, each box in the flow chart or block diagram can represent a part for a module, program segment or instruction, and a part for a module, program segment or instruction comprises one or more executable instructions for realizing the logical function of the specification. In some alternative implementations, the functions marked in the box can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be realized by a special hardware-based system that performs the function or action of the specification, or can be realized by a combination of special hardware and computer instructions.

[0092] While various implementations of the present disclosure have been described above, the foregoing description is intended to be illustrative, not exhaustive, and not 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 selected to best explain the principles of the implementations, their practical applications, or improvements to existing technologies, or to enable others skilled in the art to understand the various implementations disclosed herein.

Claims

1. A touch event processing method, comprising: 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, the at least one candidate view node respectively having a corresponding predetermined gesture; determining, 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; identifying, according to the response relationship, a corresponding predetermined gesture for a candidate view node among the at least one candidate view node based on the touch event; as well as In response to recognizing a corresponding predetermined gesture for a target view node among the at least one candidate view node, 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, determining a view node selected by the touch event and a view hierarchy structure of the plurality of view nodes; as well as The at least one candidate view node is determined based on a position of the view node selected by the touch event in the view hierarchy.

3. The method according to claim 1 , wherein determining a response relationship of the at least one candidate view node to the touch event comprises: determining a hierarchical relationship between the at least one candidate view node according to a view hierarchy structure of the plurality of view nodes; as well as The response relationship is determined based on the hierarchical relationship between the at least one candidate view node.

4. The method according to claim 1, wherein determining the response relationship of the at least one candidate view node to the touch event comprises: Obtaining at least one execution script corresponding to each of the at least one candidate view nodes, wherein the execution script in the at least one execution script includes an event recognizer of 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, a 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: generating a response flow graph indicating the response relationship according to the response relationship; assigning the touch event to a first view node among the at least one candidate view node based on the response flow graph; as well as A first predetermined gesture corresponding to the first view node is recognized based on the touch event by the first view node.

6. The method according to claim 5, wherein identifying a corresponding predetermined gesture for a candidate view node among the at least one candidate view node further comprises: In response to not recognizing the first predetermined gesture based on the touch event by the first view node, assigning the touch event to a second view node subsequent to the first view node according to the response flow graph; as well as A second predetermined gesture corresponding to the second view node is recognized based on the touch event by the second view node.

7. The method according to claim 1, wherein each of the at least one candidate view node is associated with an event recognizer, the event recognizer including a determination condition for a predetermined gesture of the associated candidate view node, and Wherein identifying a corresponding predetermined gesture for a candidate view node in the at least one candidate view node comprises: assigning the touch event to a first event recognizer associated with a first view node among the at least one candidate view node according to the response relationship; as well as A first predetermined gesture of the first view node is recognized according to the determination condition included in the first event recognizer and the touch event.

8. The method according to claim 7, wherein identifying a corresponding predetermined gesture for a candidate view node among the at least one candidate view node further comprises: In response to not recognizing the first predetermined gesture based on the touch event by the first event recognizer, determining the first event recognizer to be in a failed state; In response to the first event recognizer being in the failed state, assigning the touch event to a second event recognizer of a second view node following the first view node according to the response relationship; as well as A second predetermined gesture of the second view node is recognized based on the determination condition included in the second event recognizer and the touch event.

9. The method according to claim 7, wherein performing a corresponding target operation based on the touch event comprises: In response to recognizing the first predetermined gesture by a first event recognizer of the first view node, determining the first event recognizer to be in an active state; as well as In response to the first event recognizer being in an activated state, a corresponding target operation is performed based on the touch event through the first view node.

10. The method according to claim 1, wherein the touch event comprises at least one of the following: Touch starts the sub-event, Touch move sub-event, Touch ends the sub-event, or Touch to cancel the sub-event.

11. A device for handling touch events, comprising: 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, wherein the at least one candidate view node respectively has a corresponding predetermined gesture; a determining module configured to determine a response relationship of the at least one candidate view node to the touch event based on an association relationship between the at least one candidate view node; an identification module configured to identify, according to the response relationship and based on the touch event, a corresponding predetermined gesture for a candidate view node in the at least one candidate view node; 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 node, execute a corresponding target operation based on the touch event through the target view node.

12. An electronic device comprising: at least one processing unit; as well as At least one memory coupled to the at least one processing unit and storing instructions for execution by the at least one processing unit, the instructions causing the electronic device to perform the method according to any one of claims 1 to 10 when executed by the at least one processing unit.

13. A computer-readable storage medium having a computer program stored thereon, wherein the computer program 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 a computer program, wherein the computer program implements the method according to any one of claims 1 to 10 when executed by a processor.

Citation Information

Patent Citations

  • Method and device for processing gesture event, equipment and storage medium

    CN115344121A

  • User activity shortcut suggestion

    CN116301492A