Method and device for processing touch event, equipment and storage medium
By capturing and processing touch events in the platform layer, determining the target response components, and generating response events, the problem of low event listening efficiency in cross-terminal software development is solved, and efficient touch event response and processing is achieved.
Patent Information
- Application Number
- CN202510098595.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-21
- Publication Date
- 2025-05-06
AI Technical Summary
In the cross-terminal software development framework, traditional methods cannot effectively implement event monitoring, especially in web development, and cannot achieve custom interaction effects by listening to touch series events.
By capturing touch events in the platform layer, the target response component is determined, and event messages are sent from the platform layer to the native layer to generate a set of response events for touch events.
It realizes efficient response to touch events, improves the efficiency of event processing, and can achieve customized interaction effects in cross-terminal software development.
Smart Images

Figure CN119937891A_ABST
Abstract
Description
Technical Field
[0001] Example embodiments of the present disclosure generally relate to the field of computers, and more particularly, to methods, devices, apparatuses, and computer-readable storage media for processing touch events. Background Art
[0002] In the cross-terminal software development framework, developers often need to use event monitoring technology to implement some customized interactive effects, such as hand dragging, water ripples, etc. In web page development, event monitoring can be implemented by monitoring the touch series of events. Traditional cross-terminal software development cannot use the above method to implement event monitoring, and can only implement event monitoring through built-in components or gesture monitoring callbacks. Summary of the invention
[0003] In a first aspect of the present disclosure, a method for processing a touch event is provided. The method comprises: in response to a received touch operation, capturing a touch event corresponding to the touch operation in a platform layer; determining a target response component corresponding to the touch event in the platform layer; sending an event message from the platform layer to a native layer, the event message at least indicating the target response component; and generating, by the native layer, a set of response events for the touch event based on the event message.
[0004] In a second aspect of the present disclosure, a device for processing touch events is provided. The device includes: a capture module configured to capture a touch event corresponding to a touch operation in a platform layer in response to a received touch operation; a first determination module configured to determine a target response component corresponding to the touch event in the platform layer; a sending module configured to send an event message from the platform layer to a native layer, the event message at least indicating the target response component; and a first generation module configured to generate a set of response events for the touch event by the native layer based on the event message.
[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, the at least one memory is coupled to the at least one processing unit and stores instructions for execution by the at least one processing unit. When the instructions are executed by the at least one processing unit, the device executes 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, which includes computer executable instructions, and when the computer executable instructions are executed by a processor, the method of the first aspect is implemented.
[0008] It should be understood that the contents described in this content section are not intended to limit the key features or important features of the embodiments of the present disclosure, nor are they 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 An architectural diagram showing an example system in which embodiments according to the present disclosure may be implemented;
[0011] Figure 2 A flowchart showing an example process of processing a touch event according to some embodiments of the present disclosure;
[0012] Figure 3 A flowchart illustrating an example process for determining a target response component according to some embodiments of the present disclosure;
[0013] Figure 4 A flowchart showing an example process of generating an event message according to an embodiment of the present disclosure is shown;
[0014] Figure 5 A schematic structural block diagram showing an example apparatus for processing a touch event according to some embodiments of the present disclosure; and
[0015] Figure 6 A block diagram of an electronic device capable of implementing various embodiments of the present disclosure is shown. DETAILED DESCRIPTION
[0016] Embodiments of the present disclosure will be described in more detail below 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 being limited to the embodiments set forth herein. On the contrary, 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 only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0017] It should be noted that the titles of any sections / subsections provided herein are not restrictive. Various embodiments are described throughout this article, and any type of embodiment may be included under any section / subsection. In addition, 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 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 are subject to 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 knows and confirms. Accordingly, when implementing each embodiment of the present disclosure, the type, scope of use, usage scenario, etc. 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 can vary according to the actual situation and application scenario, and the scope of the present disclosure is not limited in this respect.
[0020] In this specification and the embodiments, if personal information processing is involved, it will be processed on the premise of having a legal basis (such as obtaining the consent of the subject of personal information, or it is necessary to perform a contract, etc.), and will only be processed within the scope of regulations or agreements. If a user refuses to process personal information other than the necessary information for basic functions, it will not affect the user's use of basic functions.
[0021] As mentioned above, in the cross-terminal software development framework, developers often need to use event monitoring technology to implement some customized interactive effects, such as hand dragging, water ripples, etc. In web page development, event monitoring can be implemented by monitoring the touch series of events. Traditional cross-terminal software development cannot use the above method to implement event monitoring, and can only implement event monitoring through built-in components or gesture monitoring callbacks.
[0022] The embodiment of the present disclosure proposes a scheme for processing touch events. The scheme includes: in response to a received touch operation, capturing a touch event corresponding to the touch operation in the platform layer; determining a target response component corresponding to the touch event in the platform layer; sending an event message from the platform layer to the native layer, the event message at least indicating the target response component; and generating a set of response events for the touch event based on the event message by the platform layer.
[0023] In this way, the embodiments of the present disclosure can efficiently respond to touch events and improve event processing efficiency.
[0024] Various example implementations of the solution are described in detail below in conjunction with the accompanying drawings.
[0025] Example Environment
[0026] Figure 1 1 is a schematic diagram of an example system 100 in which embodiments of the present disclosure can be implemented. Figure 1 As shown, the example system 100 may include a platform layer 110 , a native layer 120 , and a framework layer 130 .
[0027] When the system 100 receives the user's interactive operation on the software interface, the system 100 can capture the relevant touch event through the platform layer 110. Further, the system 100 can determine the target response component through the platform layer 110. After determining the target response component, the system 100 can process the event message sent by the platform layer 110 through the native layer 120, and generate a set of response events for the touch event through the native layer to process the touch event.
[0028] In some embodiments, the system 100 may be deployed in a server, which may be an independent physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content distribution networks, and big data and artificial intelligence platforms. The server 130 may include, for example, a computing system / server, such as a mainframe, an edge computing node, a computing device in a cloud environment, and the like.
[0029] It should be understood that the structure and function of the various elements in the environment 100 are described for exemplary 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 flowchart of an example process 200 for processing a touch event according to some embodiments of the present disclosure. The process 200 may be implemented at the electronic device 110. Figure 1 The process 200 is described below.
[0033] like Figure 2 As shown, in block 210, in response to receiving a touch operation, the system 100 captures a touch event corresponding to the touch operation in the platform layer. Figure 1 As shown, the system 100 includes a platform layer 110, a native layer 120 and a framework layer 130. For the IOS platform, the native layer can also be referred to as a C++ layer. After receiving a touch operation from a user, the system 100 can capture a touch event corresponding to the touch operation through the platform layer 110. Specifically, after receiving a touch operation 111 through the interface 112, the system 110 can capture a touch event corresponding to the touch operation 111 through an inline event processing module. The inline event processing module can be used to monitor touch events.
[0034] In some embodiments, the system 100 can capture touch events corresponding to touch operations in the platform layer using a set of predefined event listeners. The event listeners are created based on event interfaces associated with components.
[0035] As an example, the system 100 may pre-deploy a set of predefined event listeners in the platform layer 110. Such a set of predefined event listeners is created by the system 100 based on the event interface associated with the component. Different event listeners are used to listen to different types of touch events. The types of touch events may include, for example: touch start type, slide type, touch end type, touch cancel type, tap type, and long press type. Examples of event listeners corresponding to different types of touch events are as follows:
[0036] <view
[0037] bindtouchstart={(e)=>{console.log('touchstart',e);}}
[0038] bindtouchmove={(e)=>{console.log('touchmove',e);}}
[0039] bindtouchend={(e)=>{console.log('touchend',e);}}
[0040] bindtouchcancel={(e)=>{console.log('touchcancel',e);}}
[0041] bindtap={(e)=>{console.log('tap',e);}}
[0042] bindlongpress={(e)=>{console.log('longpress',e);}}
[0043] / >
[0044] There are four types of event monitoring: monitoring events in the bubbling phase, not intercepting event bubbling, monitoring events in the bubbling phase, intercepting event bubbling, monitoring events in the capture phase, not intercepting event bubbling, monitoring events in the capture phase, intercepting event bubbling. To more clearly represent the multiple types of event monitoring, you can refer to the following table:
[0045]
[0046] By monitoring touch events through predefined event listeners, the event listeners can be flexibly controlled based on an interface for creating event listeners, thereby improving software development efficiency.
[0047] When the system 100 captures a touch event, the system 100 may determine the best response component corresponding to the touch event. Specifically, in block 220, the system 100 determines the target response component corresponding to the touch event in the platform layer. For example, Figure 3 As shown, the system 100 can determine the target response component corresponding to the touch event through the touch event processing module 113 in the platform layer 110. Specifically, when the user touches the screen, the system 100 can perform a predefined hit test on the interface tree through the touch event processing module 113 to determine the component that best responds to the touch event. Determining the best response component (i.e., the target response component) only through the capabilities of the platform layer can effectively avoid strong dependence on the platform layer segment capability interface.
[0048] In some embodiments, the system 100 can search for a target response component corresponding to a touch event from a root component of the interface based on the interface component hierarchy information. The component hierarchy information indicates a hierarchical relationship of a set of interface components in the interface. For example, Figure 3 As shown, Figure 3The process 300 of determining the target response component of some embodiments of the present disclosure is shown. After the system 100 captures a touch event, the system 100 can send the touch event down to execute a predefined hit test task 320. When executing the hit test task 320, the system 100 can perform a reverse traversal task 330, that is, starting from the root node (i.e., the root component) of the interface tree, and traversing downward to determine the target response node (i.e., the target response component) corresponding to the touch event.
[0049] In some embodiments, when performing hit test 320, system 100 may determine whether a first subcomponent of the first component responds to a touch event in response to the first component in the interface being suitable for processing a touch event. Further, system 100 may determine the first component as a target response component in response to the subcomponent being unsuitable for responding to a touch event.
[0050] As an example, Figure 3 As shown, the system 100 can perform a response determination task 340 during the reverse traversal task 330. When the system 100 performs the response determination task 340, multiple candidate nodes in the interface tree that can respond to touch events can be determined. After determining multiple candidate nodes, the system 100 can perform a judgment task 350 to determine whether there are child nodes under the multiple candidate nodes that can respond to touch events. When the system 100 determines that the target candidate node does not have a child node that can respond to touch events, the system 100 can perform a return to itself task 360 to use the target candidate node (i.e., the first component) as the best response component (i.e., the target response component).
[0051] For example, the system 100 may traverse each node downward from the root node in the interface tree and determine whether each traversed node can respond to a touch event when performing the reverse traversal task 330. When there is no child node that can respond to a touch event under the traversed target candidate node, the system 100 may determine that the target candidate node is a target response node (i.e., a target response component).
[0052] In some embodiments, the system 100 may determine whether a second subcomponent of the second component is suitable for responding to a touch event in response to the second component in the interface being unsuitable for responding to a touch event and the second component being set to a target mode. The target mode indicates that a subcomponent of the second component is allowed to exceed the display range of the second component. Further, the system 100 may determine a target response component based on the third component in response to determining that a third component in the second subcomponent is suitable for responding to a touch event.
[0053] As an example, when the display range of the second subcomponent in the second component exceeds the display range of the second component, the user's touch operation on the second subcomponent will not belong to the touch hot zone of the second component. However, the component that should respond to the user's touch operation should be the second subcomponent or other subcomponents in the second subcomponent. For such a problem, the system 100 can call the hit test interface of the second subcomponent to determine whether the third component in the second subcomponent is suitable for responding to touch events. If the third component is suitable for responding to touch events, the system 100 can use the third component as the target response component.
[0054] For example, the display range of the second component is 50*50, and the display range of the second subcomponent is 100*100. If the property of the second component is set to allow the display range of the second subcomponent to exceed the second component, the second subcomponent will be presented in the interface. If the system 100 receives a touch operation outside the display range of the second component but within the display area of the second subcomponent, in order to ensure the accuracy of the touch operation response, the system 100 can perform a hit test on the third component in the second subcomponent to accurately determine the component used to respond to the touch operation.
[0055] In some embodiments, the system 100 may determine whether the corresponding component is suitable for responding to a touch event based on at least one component property of the corresponding component, wherein the at least one component property includes at least one of a display level of the component, visibility of the component, and a touch hotspot of the component.
[0056] As an example, when the system 100 determines whether the corresponding component is suitable for responding to a touch event, the system 100 may first determine whether the display level of the target component is at a level visible to the user, that is, whether the target component is blocked by other components. For example, the target component is stacked with other components, and the system 100 may obtain the display priority of such a group of components. Further, the system 100 may determine whether the target component is displayed at the top layer based on the display priority of the target component.
[0057] After determining that the target component is at a level visible to the user, the system 100 can determine the visibility of the target component based on the transparency of the target component. For example, the system 100 can determine whether the target component is in a completely transparent state, or the length or width of the target component is 0. When the target component is in a completely transparent state, or the length or width of the target component is 0, it means that the target component is in an invisible state, and the system 100 will exclude the component.
[0058] When the target component is determined to be at a user-visible level and has visibility, the system 100 can obtain the first touch hotspot indicated by the user's touch operation. Further, the system 100 can determine whether the first touch hotspot matches the second touch hotspot of the target component. When the first touch hotspot matches the second touch hotspot, the system 100 can determine that the target component is a component suitable for responding to touch events.
[0059] In some embodiments, the touch event is a first touch event. In response to the touch operation being a press operation, the system 100 may determine, in the platform layer, a target response component corresponding to the first touch event. As an example, Figure 4 As shown, Figure 4 A flowchart of an example process of generating an event message of some embodiments of the present disclosure is shown. When generating an event message, the system 100 may first determine the type of touch operation 410, and the type of touch operation 410 may include, for example, a press type, a slide type, etc. When the system 100 determines that the type of the touch operation is a press type (i.e., the touch operation is a press operation), the system 100 may perform an interface hit test 420 based on the press operation to determine the best response component 430. Whenever the system 100 receives a touch operation, the system 100 captures the touch event 440 through a predefined event listener and processes the touch event 450. After processing the touch event, the system 100 may obtain information associated with the touch event, such as relative position information corresponding to the touch event. After processing the touch event 450, the system 100 may encapsulate the relevant information of the touch event to construct a subsequent first event message and send the event message 460.
[0060] In some embodiments, the event message is a first event message. The system 100 may also generate, in the platform layer, a second event message corresponding to a second touch event corresponding to the gesture operation in response to the touch operation being a gesture operation. The second event message at least indicates the gesture type of the gesture operation. As an example, Figure 4 When the system 100 determines that the touch operation is a gesture operation, the system 100 may perform gesture analysis 470 on the gesture operation to obtain information associated with the gesture operation (e.g., the gesture type of the gesture operation). Further, the system 100 may construct a second event message based on the information associated with the gesture operation and the information associated with the touch event.
[0061] In some embodiments, when the system 100 determines that the touch operation is a special operation other than a press and gesture operation, the system 100 may process 480 a special scenario corresponding to the special operation. The special scenario may include, for example, loss of focus, event penetration, and preventing side sliding and scrolling. When the system 100 determines that the received touch operation is a special operation, no event message is generated.
[0062] Continue to refer Figure 2 At block 230, the system 100 sends an event message from the platform layer to the native layer. The event message at least indicates the target response component. As an example, Figure 1 As shown, after the system 100 completes the construction of the event message, the event message can be sent to the engine 121 in the native layer 120 through the event dispatching module 114. Such an event message includes a target response component and parameters related to the touch event. The parameters related to the touch event can be, for example, the relative position information corresponding to the touch operation in the interface.
[0063] Continue to refer Figure 2 In block 240, the system 100 generates a set of response events for the touch event based on the event message by the native layer. As an example, Figure 1 As shown, after sending the event message to the native layer 120, the system 100 can generate a response chain associated with the touch event through the response chain generation module 122. Further, the system 100 can generate a set of response events for the touch event through the event queue generation module 123. By performing event capture and bubbling logic through the native layer, the event processing logic of multiple platforms can be unified, thereby improving the efficiency of cross-platform software development.
[0064] In some embodiments, the system 100 may determine the target response component indicated by the platform based on the event message, and determine the event response chain. Further, the system 100 may determine at least one component to respond to the touch event based on the event response chain. Finally, the system 100 may generate a set of response events for the touch event based on at least one component.
[0065] As an example, after sending the event message to the native layer 120 , the system 100 may call the response chain generation module 122 in the native layer 120 to control the response chain generation module 122 to determine the response chain based on the target response component.
[0066] For example, the system 100 may obtain an identifier corresponding to the touch event based on the event message. Further, the system 100 may determine the component corresponding to the identifier through the identifier. After determining the component corresponding to the identifier, the system 100 may traverse upward based on the component to determine the path from the component to the root component of the interface, thereby generating an event response chain.
[0067] After determining the response chain, the system 100 can determine multiple components of the touch event to be responded to. Further, the system 100 can traverse the event response chain through the event queue generation module 123, and execute the logic of event capture and bubbling for each traversed component. Further, the system 100 can control the event queue generation module 123 to generate an event queue (i.e., a set of response events) according to the multiple components of the touch event to be responded to.
[0068] In some scenarios, after the event queue is generated, the system 100 can also control the event parameter acquisition module 124 to parse and acquire event parameters for processing the touch event, so as to process the touch event later. Further, the system 100 can trigger the response event in the execution time queue through the event trigger module 125.
[0069] In some embodiments, after a set of response events is generated, the system 100 may send the set of response events to the framework layer to execute the set of response events in the framework layer. Figure 1 As shown, after the event queue (i.e., a set of response events) is generated, the system 100 can send the event queue (i.e., a set of response events) to the framework layer 120 based on the runtime communication interface. After the event queue (i.e., a set of response events) is sent to the framework layer 120, the system 100 can execute the event queue (i.e., a set of response events) through the event publishing module 131 and the callback module 132 to process the touch operation corresponding to the event queue.
[0070] In this way, the embodiments of the present disclosure can efficiently respond to touch events and improve event processing efficiency.
[0071] Example devices and equipment
[0072] The embodiments of the present disclosure also provide corresponding devices for implementing the above methods or processes. Figure 5 A schematic structural block diagram of an example apparatus 500 for processing a touch event according to some embodiments of the present disclosure is shown. The apparatus 500 may be implemented as or included in the electronic device 110. Each module / component in the apparatus 500 may be implemented by hardware, software, firmware, or any combination thereof.
[0073] like Figure 5As shown, the device 500 includes: a capture module 510, configured to capture a touch event corresponding to a touch operation in a platform layer in response to a received touch operation; a first determination module 520, configured to determine a target response component corresponding to the touch event in the platform layer; a sending module 530, configured to send an event message from the platform layer to the native layer, the event message at least indicating the target response component; and a first generation module 540, configured to generate, by the native layer, a set of response events for the touch event based on the event message.
[0074] In some embodiments, the apparatus 500 further includes an execution module configured to send a set of response events to the framework layer to execute the set of response events in the framework layer.
[0075] In some embodiments, the first determination module 520 is further configured to search for a target response component corresponding to a touch event from a root component of the interface based on component hierarchy information of the interface, wherein the component hierarchy information indicates a hierarchical relationship of a set of interface components in the interface.
[0076] In some embodiments, the first determination module 520 is also configured to: in response to the first component in the interface being suitable for processing touch events, determine whether a first group of subcomponents of the first component are suitable for responding to touch events; and in response to the subcomponents being unsuitable for responding to touch events, determine the first component as a target response component.
[0077] In some embodiments, the first determination module 520 is further configured to: in response to a second component in the interface being not suitable for responding to a touch event and the second component being set to a target mode, determine whether a second group of subcomponents of the second component are suitable for responding to a touch event, the target mode indicating that sub-node components of the second component are allowed to exceed the display range of the second component; and in response to determining that a third component in the second group of subcomponents is suitable for responding to a touch event, determine a target response component based on the third component.
[0078] In some embodiments, the device 500 also includes a second determination module, which is configured to determine whether the corresponding component is suitable for responding to a touch event based on at least one component attribute of the corresponding component, and the at least one component attribute includes at least one of the following: the display level of the component; the visibility of the component; the touch hot zone of the component.
[0079] In some embodiments, the touch event is a first touch event, and the first determination module 520 is further configured to: in response to the touch operation being a pressing operation, determine, in the platform layer, a target response component corresponding to the first touch event.
[0080] In some embodiments, the event message is a first event message, and the device 500 also includes a second generation module, which is configured to generate a second event message corresponding to a second touch event corresponding to the gesture operation in the platform layer in response to the touch operation being a gesture operation, and the second event message at least indicates the gesture type of the gesture operation.
[0081] In some embodiments, the first generation module 540 is also configured to: determine the platform layer based on the target response component indicated by the event message, determine the event response chain, the event response chain indicates the path from the target response component to the root component in the interface; based on the event response chain, determine at least one component to respond to the touch event; and based on at least one component, generate a set of response events for the touch event.
[0082] In some embodiments, the capture module 510 is further configured to capture touch events corresponding to touch operations in the platform layer using a set of predefined event listeners, where the event listeners are created based on event interfaces associated with the components.
[0083] The modules included in the device 500 can be implemented in various ways, including software, hardware, firmware, or any combination thereof. In some embodiments, one or more 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 in the device 500 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 chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0084] Figure 6 1 shows a block diagram of an electronic device 600 in which one or more embodiments of the present disclosure may be implemented. It should be understood that Figure 6 The electronic device 600 shown is merely exemplary and should not constitute any limitation on the functionality and scope of the embodiments described herein. Figure 6 The illustrated electronic device 600 may be used to implement the electronic device 110 as discussed above.
[0085] like Figure 6As shown, the electronic device 600 is in the form of a general electronic device. The components of the electronic device 600 may include, but are not limited to, one or more processors or processing units 610, a memory 620, a storage device 630, one or more communication units 640, one or more input devices 650, and one or more output devices 660. The processing unit 610 may be an actual or virtual processor and is capable of performing various processes according to a program stored in the memory 620. In a multi-processor system, multiple processing units execute computer executable instructions in parallel to improve the parallel processing capability of the electronic device 600.
[0086] The electronic device 600 typically includes a plurality of computer storage media. Such media may be any accessible media that is accessible to the electronic device 600, including but not limited to volatile and non-volatile media, removable and non-removable media. The memory 620 may be a volatile memory (e.g., registers, caches, random access memory (RAM)), a non-volatile memory (e.g., a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), flash memory), or some combination thereof. The storage device 630 may be a removable or non-removable medium, and may include a machine-readable medium, such as a flash drive, a disk, or any other medium, which may be capable of being used to store information and / or data and may be accessed within the electronic device 600.
[0087] The electronic device 600 may further include additional removable / non-removable, volatile / non-volatile storage media. Figure 6 As shown in , a disk drive for reading or writing from a removable, non-volatile disk (e.g., a "floppy disk") and an optical drive for reading or writing from a removable, non-volatile optical disk may be provided. In these cases, each drive may be connected to the bus (not shown) by one or more data media interfaces. The memory 620 may include a computer program product 625 having one or more program modules that are configured to perform various methods or actions of various embodiments of the present disclosure.
[0088] The communication unit 640 implements communication with other electronic devices through a communication medium. Additionally, the functions of the components of the electronic device 600 can be implemented with a single computing cluster or multiple computing machines that can communicate through a communication connection. Therefore, the electronic device 600 can operate in a networked environment using a logical connection with one or more other servers, a network personal computer (PC), or another network node.
[0089] The input device 650 may be one or more input devices, such as a mouse, a keyboard, a tracking ball, etc. The output device 660 may be one or more output devices, such as a display, a speaker, a printer, etc. The electronic device 600 may also communicate with one or more external devices (not shown) through the communication unit 640 as needed, such as a storage device, a display device, etc., communicate with one or more devices that allow a user to interact with the electronic device 600, or communicate with any device that allows the electronic device 600 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).
[0090] 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.
[0091] Various aspects of the present disclosure are described herein with reference to the flowcharts and / or block diagrams of the methods, devices, equipment, and computer program products implemented according to the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer-readable program instructions.
[0092] 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, so that when these instructions are executed by the processing unit of the computer or other programmable data processing device, a device that implements the functions / actions specified in one or more boxes in the flowchart and / or block diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for implementing various aspects of the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0093] 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, so that the instructions executed on the computer, other programmable data processing apparatus, or other device implement the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0094] The flow chart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to multiple implementations of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a part of a module, program segment or instruction, and a part of a module, program segment or instruction includes one or more executable instructions for realizing the logical function of the specification. In some implementations as replacements, the function marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous square boxes can actually be executed substantially in parallel, and they can sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square 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.
[0095] The above descriptions of various implementations of the present disclosure are exemplary, non-exhaustive, and not limited to the disclosed implementations. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described implementations. The selection of terms used herein is intended to best explain the principles of the implementations, practical applications, or improvements to the technology in the market, or to enable other persons of ordinary skill in the art to understand the various implementations disclosed herein.
Claims
1. A method for processing a touch event, comprising: In response to the received touch operation, capturing a touch event corresponding to the touch operation in the platform layer; In the platform layer, determining a target response component corresponding to the touch event; Sending an event message from the platform layer to the native layer, the event message at least indicating the target response component; as well as The native layer generates a set of response events for the touch event based on the event message.
2. The method according to claim 1, further comprising: The set of response events is sent to the framework layer so as to be executed in the framework layer.
3. The method according to claim 1, wherein in the platform layer, determining a target response component corresponding to the touch event comprises: Based on component hierarchy information of an interface, the target response component corresponding to the touch event is searched from a root component of the interface, wherein the component hierarchy information indicates a hierarchical relationship of a group of interface components in the interface.
4. The method according to claim 3, wherein searching the target response component corresponding to the touch event from the root component of the interface comprises: In response to a first component in the interface being suitable for processing the touch event, determining whether a first group of subcomponents of the first component is suitable for responding to the touch event; as well as In response to the subcomponent being inappropriate for responding to the touch event, the first component is determined as the target response component.
5. The method according to claim 3, wherein searching the target response component corresponding to the touch event from the root component of the interface comprises: In response to a second component in the interface being inappropriate for responding to the touch event and the second component being set to a target mode, determining whether a second group of subcomponents of the second component are appropriate for responding to the touch event, the target mode indicating that subcomponents of the second component are allowed to exceed a display range of the second component; as well as In response to determining that a third component in the second subcomponent is suitable for responding to the touch event, the target response component is determined based on the third component.
6. The method according to claim 4 or 5, further comprising: Determining whether the corresponding component is suitable for responding to the touch event based on at least one component property of the corresponding component, wherein the at least one component property includes at least one of the following: The display hierarchy of components; Visibility of components; Touch hotspots of components.
7. The method according to claim 1, wherein the touch event is a first touch event, and in the platform layer, determining a target response component corresponding to the touch event comprises: In response to the touch operation being a pressing operation, in the platform layer, the target response component corresponding to the first touch event is determined.
8. The method according to claim 7, wherein the event message is a first event message, the method further comprising: In response to the touch operation being a gesture operation, a second event message corresponding to a second touch event corresponding to the gesture operation is generated in the platform layer, and the second event message at least indicates a gesture type of the gesture operation.
9. The method according to claim 1, wherein generating, by the platform layer based on the event message, a set of response events for the touch event comprises: Determine the platform layer to determine an event response chain based on the target response component indicated by the event message, wherein the event response chain indicates a path from the target response component to a root component in an interface; Based on the event response chain, determining at least one component to respond to the touch event; as well as The set of response events for the touch event is generated based on the at least one component.
10. The method according to claim 1, wherein in response to the received touch operation, capturing a touch event corresponding to the touch operation in the platform layer comprises: The touch event corresponding to the touch operation is captured in the platform layer by using a set of predefined event listeners, wherein the event listeners are created based on an event interface associated with a component.
11. A device for processing a touch event, comprising: a capture module configured to capture, in response to a received touch operation, a touch event corresponding to the touch operation in a platform layer; A first determination module is configured to determine, in the platform layer, a target response component corresponding to the touch event; A sending module, configured to send an event message from the platform layer to the native layer, wherein the event message at least indicates the target response component; as well as The first generating module is configured to generate, by the native layer, a set of response events for the touch event based on the event message.
12. An electronic device comprising: at least one processing unit; as well as At least one memory, the at least one memory being 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 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.