Page processing method
By preconfiguring the label, priority and sliding mode of the sliding layer, the candidate sliding layer is determined and the corresponding sliding operation is triggered, which solves the problem of judgment errors in response to sliding operations by multiple sliding layers in the prior art, improves the accuracy of sliding processing and reduces resource occupancy.
Patent Information
- Application Number
- CN202411832872.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-12
- Publication Date
- 2025-04-11
AI Technical Summary
In the prior art, multiple sliding layers may cause judgment errors in response to sliding operations, and cannot accurately drive the required scrolling layer to slide, resulting in inaccurate content display on the page.
By preconfiguring the label, priority, and preset sliding modes for the sliding layer to be executed, when each sliding layer receives a touch start event, a candidate sliding layer that can execute the event is determined and placed into a set of candidate sliding layers. Upon receiving the sliding process event, it is determined whether the sliding layer with the highest priority in the candidate sliding layer set is the current sliding layer, and if so, a corresponding sliding operation is triggered.
Improve the accuracy of sliding processing, avoid judgment errors caused by multiple sliding layers responding simultaneously, reduce resource occupancy, and ensure accurate display of page content.
Smart Images

Figure CN119806375A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a page processing method. Background Art
[0002] During the operation of the client program, the scroll layer (ScrollView) is used to identify the operation triggered by the user to change the content displayed on the client page. The client page is generally designed to switch between different lists by sliding left and right. The list page of each list corresponds to the screen size of the mobile terminal where the client program is installed. Each list page itself includes the overall content that can be slid up and down, and a local area that can be slid left and right can be set in the overall content. Furthermore, a scroll layer is set for the entire client page, each list page, and the local area included in each list page, and the scroll judgment of each scroll layer is performed independently.
[0003] Among them, since it is necessary to slide a little bit to know the preliminary sliding direction, each scrolling layer will determine whether to slide on its own scrolling layer. When sliding left and right, it may cause the sliding layers corresponding to the local areas of the client page and the list page to slide, or only the local area needs to be driven to slide, but the sliding exceeds the range of the scrolling layer corresponding to the local area, causing the scrolling layer corresponding to the client page to slide. That is, when the sliding direction corresponds to multiple scrolling layers, a judgment error may occur, resulting in the inability to accurately drive the required scrolling layer to slide. Summary of the invention
[0004] In view of this, the purpose of the present application is to at least provide a page processing method, by pre-configuring the sliding layer's label, priority and allowed preset sliding mode, so that when each sliding layer receives a touch start event of a touch identifier, the candidate sliding layer that can execute the touch operation corresponding to the touch identifier is first determined based on the range covered by the sliding layer and the candidate sliding layer is placed in a candidate sliding layer set, so that when each sliding layer receives a sliding process event corresponding to the current touch identifier, it is determined whether the first candidate sliding layer with the highest priority label in the candidate sliding layer set that can execute the sliding process event is the sliding layer, and if so, the sliding layer changes the displayed user interaction page corresponding to the sliding operation corresponding to the sliding process event, thereby solving the technical problem in the prior art that multiple sliding layers respond to sliding operations to change the displayed content of the control page, and achieving the technical effect of increasing the accuracy of sliding processing and reducing resource occupancy.
[0005] This application mainly includes the following aspects:
[0006] In a first aspect, an embodiment of the present application provides a page processing method, which provides a user interaction page through a terminal device, wherein the user interaction page corresponds to multiple sliding layers, each sliding layer includes a pre-configured label, a priority, and a preset sliding mode allowed to be executed. The method includes: for each sliding layer, when the sliding layer detects a touch start event of a current touch identifier, at least one candidate sliding layer covering the start touch position corresponding to the touch start event is added to a candidate sliding layer set, a sliding process event corresponding to the current touch identifier is received at the sliding layer, a target sliding direction is determined according to a sliding vector corresponding to the sliding process event, and it is determined whether the sliding layer is the same as the preset sliding layer of the candidate sliding layer set, the preset sliding layer is used to indicate the candidate sliding layer with the first label of the highest priority whose preset sliding mode matches the target sliding direction, and when the sliding layer is the same as the preset sliding layer of the candidate sliding layer set, a sliding operation corresponding to the sliding process event is triggered, so that the user interaction page displays the sliding page content according to the sliding operation triggered on the sliding layer.
[0007] Optionally, determining the target sliding direction based on the sliding vector corresponding to the sliding process event includes: acquiring the sliding vector from the starting touch position to the current sliding position in real time during the sliding process of the sliding operation corresponding to the sliding process event; determining whether the sliding length of the sliding vector is greater than a preset vector length; when the sliding length of the sliding vector is greater than the preset vector length, determining a first coordinate length in a first direction and a second coordinate length in a second direction of the current sliding position corresponding to the sliding vector, the first direction being one of a horizontal direction and a vertical direction, and the second direction being the other of a horizontal direction and a vertical direction; and determining whether the target sliding direction is the horizontal direction or the vertical direction based on a comparison result of the first coordinate length and the second coordinate length.
[0008] Optionally, the preset sliding mode allowed to be executed corresponding to each sliding layer is any one of the following: a horizontal sliding mode, a vertical sliding mode and an unlocked direction sliding mode, wherein, when the target sliding direction is a horizontal direction, the preset sliding mode of the sliding layer matching the horizontal direction includes a horizontal sliding mode and an unlocked direction sliding mode, and when the target sliding direction is a vertical direction, the preset sliding mode of the sliding layer matching the horizontal direction includes a vertical sliding mode and an unlocked direction sliding mode.
[0009] Optionally, the touch start event of the current touch identifier is detected in the sliding layer and determined in the following manner: when receiving the touch start event corresponding to the target touch identifier, determine whether the target touch identifier is an unprocessed touch identifier; when the target touch identifier is an unprocessed touch identifier, clear the candidate sliding layer set and use the target touch identifier as the current touch identifier, so that the touch start event corresponding to the target touch identifier is used as the touch start event of the current touch identifier; when the target touch identifier is a processed touch identifier, ignore the target touch identifier.
[0010] Optionally, for each sliding layer, when the sliding layer receives a sliding process event corresponding to the current touch identifier, the method further includes: determining a sliding mark of the sliding layer, the sliding mark including a sliding mark in progress and a non-sliding mark not in the sliding process; when the sliding mark of the sliding layer is the non-sliding mark, determining a target sliding direction according to a sliding vector corresponding to the sliding process event; and when the sliding mark of the sliding layer is the sliding mark, triggering a sliding operation corresponding to the sliding process event.
[0011] Optionally, for each sliding layer, after determining whether the sliding layer is the same as the preset sliding layer of the candidate sliding layer set, the method further includes: when the sliding layer is the same as the preset sliding layer of the candidate sliding layer set, changing the sliding mark of the sliding layer from the non-sliding mark to the sliding mark; when the sliding layer is not the same as the preset sliding layer of the candidate sliding layer set, the sliding layer triggers the sliding cancel event corresponding to the current touch identifier.
[0012] Optionally, for each sliding layer, the method further includes: when the sliding layer detects the sliding end event corresponding to the current touch identifier, determining whether the candidate sliding layer set is an empty set; if the candidate sliding layer set is not an empty set, determining whether the sliding marks corresponding to the multiple sliding layers corresponding to the user interaction page are all in the non-sliding mark; if the sliding marks corresponding to the multiple sliding layers are all in the non-sliding mark, determining whether the sliding layer is the same as the target sliding layer in the candidate sliding layer set, the target sliding layer is the first numbered candidate sliding layer with the highest priority in the candidate sliding layer set; when the sliding layer is the same as the target sliding layer in the candidate sliding layer set, determining that the sliding end event corresponding to the current touch identifier is a click event, and triggering the touch operation corresponding to the click event, so that the user interaction page displays the page content after the click according to the touch operation triggered on the sliding layer.
[0013] Optionally, for each sliding layer, the method further includes: setting the operating state of the sliding layer, the operating state including a sliding state and a cancel sliding state, wherein the operating state of the sliding layer is set in the following manner: when the sliding layer is added as a candidate sliding layer to the candidate sliding layer set, the operating state of the sliding layer is set to the sliding state, and when the sliding layer triggers a sliding cancel event corresponding to the current touch identifier, the operating state of the sliding layer is set to the cancel sliding state.
[0014] In a second aspect, an embodiment of the present application further provides an electronic device, comprising: a processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the memory communicate through the bus, and the machine-readable instructions are executed by the processor to execute the steps of the page processing method described in the first aspect or any possible implementation manner of the first aspect.
[0015] In a third aspect, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the page processing method described in the first aspect or any possible implementation of the first aspect are executed.
[0016] A page processing method provided by an embodiment of the present application provides a user interaction page through a terminal device, wherein the user interaction page corresponds to multiple sliding layers, each sliding layer includes a pre-configured label, a priority, and a preset sliding mode allowed to be executed. The method includes: for each sliding layer, when the sliding layer detects a touch start event of a current touch identifier, at least one candidate sliding layer covering a start touch position corresponding to the touch start event is added to a candidate sliding layer set, a sliding process event corresponding to the current touch identifier is received at the sliding layer, a target sliding direction is determined according to a sliding vector corresponding to the sliding process event, and it is determined whether the sliding layer is the same as a preset sliding layer of the candidate sliding layer set, the preset sliding layer is used to indicate the candidate sliding layer with the first label of the highest priority whose preset sliding mode matches the target sliding direction, and when the sliding layer is the same as the preset sliding layer of the candidate sliding layer set, a sliding operation corresponding to the sliding process event is triggered, so that the user interaction page displays the sliding page content according to the sliding operation triggered on the sliding layer. By pre-configuring the number, priority and preset sliding mode of the sliding layer, when each sliding layer receives a touch start event of a touch identifier, at least one candidate sliding layer that can execute the touch operation corresponding to the touch identifier is first determined according to the range covered by the sliding layer and the at least one candidate sliding layer is placed in the candidate sliding layer set. In this way, when each sliding layer receives a sliding process event corresponding to the current touch identifier, it is determined whether the first candidate sliding layer with the highest priority number in the candidate sliding layer set that can execute the sliding process event is the sliding layer. If so, the sliding layer changes the displayed user interaction page in response to the sliding operation corresponding to the sliding process event, thereby solving the technical problem in the prior art that multiple sliding layers respond to the sliding operation to change the displayed content of the control page, thereby achieving the technical effect of increasing the accuracy of sliding processing and reducing resource occupancy.
[0017] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0019] Figure 1 A flow chart of a page processing method provided in an embodiment of the present application is shown.
[0020] Figure 2 A flowchart showing the steps performed by the sliding layer provided in an embodiment of the present application when receiving a touch start event of a current touch identifier.
[0021] Figure 3 A flowchart showing the steps performed by the sliding layer provided in an embodiment of the present application when receiving a sliding process event of the current touch marker.
[0022] Figure 4 A schematic structural diagram of an electronic device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0023] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It should be understood that the drawings in the present application only serve the purpose of explanation and description and are not used to limit the scope of protection of the present application. In addition, it should be understood that the schematic drawings are not drawn in real proportion. The flowchart used in this application shows the operations implemented according to some embodiments of the present application. It should be understood that the operations of the flowchart can be implemented out of sequence, and the steps without logical context can be reversed in order or implemented simultaneously. In addition, those skilled in the art, under the guidance of the content of the present application, can add one or more other operations to the flowchart, or remove one or more operations from the flowchart.
[0024] In addition, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.
[0025] In the prior art, a complete client page is reflected in ScrollViewA, and the client page can switch between different lists by sliding left and right; ScrollViewB1 and ScrollViewB2 are used to respectively reflect the list pages corresponding to each list after sliding left and right, and ScrollViewB1 and ScrollViewB2 can both scroll and display the contents of the list pages by sliding up and down on their respective list pages; ScrollViewC1_1 and ScrollViewC1_2 are used to illustrate that two local areas that can slide left and right are set on the list page corresponding to ScrollViewB1, and ScrollViewC2_1 and ScrollViewC2_2 are used to illustrate that two local areas that can slide left and right are set on the list page corresponding to ScrollViewB2, that is, ScrollViewC1_1, ScrollViewC1_2, ScrollViewC2_1 and ScrollViewC2_2 can only drive the contents of their respective local areas to slide left and right, and cannot drive the list page to slide left and right.
[0026] Among them, since it is necessary to slide a little bit to know the preliminary sliding direction, each scrolling layer will determine whether to implement sliding in its own scrolling layer. For example, if the page displayed by the current terminal device is the list page corresponding to ScrollViewB1, when the user performs a left and right sliding operation, since ScrollViewC2_1 and ScrollViewC2_2 are two local areas that can slide left and right set on the list page corresponding to ScrollViewB2, ScrollViewA, ScrollViewC1_1 and ScrollViewC1_2 can all respond to the left and right sliding performed by the user, which may cause the list page of the page displayed by the current terminal device to slide left and right, and the local areas corresponding to ScrollViewC1_1 and ScrollViewC1_2 also slide left and right at the same time, which causes ScrollViewA, ScrollViewC1_1 and ScrollViewC1_2 sliding layers to change the page display content according to the sliding operation, resulting in a large background occupation and affecting the user experience.
[0027] Based on this, the embodiment of the present application provides a page processing method, which pre-configures the label, priority and preset sliding mode of the sliding layer, so that when each sliding layer receives a touch start event of a touch identifier, the candidate sliding layer that can execute the touch operation corresponding to the touch identifier is first determined according to the range covered by the sliding layer and the candidate sliding layer is placed in a candidate sliding layer set, so that when each sliding layer receives a sliding process event corresponding to the current touch identifier, it is determined whether the first label candidate sliding layer with the highest priority that can execute the sliding process event in the candidate sliding layer set is the sliding layer, and if so, the sliding layer changes the displayed user interaction page corresponding to the sliding operation corresponding to the sliding process event, thereby solving the technical problem in the prior art that multiple sliding layers respond to the sliding operation to change the displayed content of the control page, and achieving the technical effect of increasing the accuracy of sliding processing and reducing resource occupancy, which is specifically as follows:
[0028] See also Figure 1 , Figure 1 This is a flow chart of a page processing method provided by an embodiment of the present application. Figure 1 As shown, the page processing method provided in the embodiment of the present application includes the following steps:
[0029] S101: for each sliding layer, when the sliding layer detects a touch start event of a current touch identifier, at least one candidate sliding layer covering a start touch position corresponding to the touch start event is added to a candidate sliding layer set.
[0030] Wherein, a user interaction page is provided through a terminal device, and the user interaction page corresponds to a plurality of sliding layers, each sliding layer including a pre-configured label, a priority and a preset sliding mode allowed to be executed.
[0031] The terminal device involved in the embodiments of the present application mainly refers to a smart device for providing a user interaction page of a client program and capable of changing the displayed content in the page in response to the operation performed by the receiving user. The terminal device may include but is not limited to any of the following devices: a smart phone, a tablet computer, a portable computer, a desktop computer, a game console, a personal digital assistant (PDA), an e-book reader, an MP4 (Moving Picture Experts Group AudioLayer IV) player, etc. The terminal device is installed and running with a client program that supports online courses, and can provide course pages corresponding to multiple subjects.
[0032] Among them, the user interaction page of the client program displayed on the terminal device corresponds to multiple sliding layers. Exemplarily, the multiple sliding layers corresponding to the user interaction page include a first sliding layer, a second sliding layer and a third sliding layer. The first sliding layer corresponds to the complete user interaction page of the client program, and can switch the course page corresponding to the first subject and the course page corresponding to the second subject by sliding left and right, that is, the first sliding layer processes the left and right sliding operations performed on the user interaction page to switch the course pages corresponding to the first subject and the second subject respectively. The second sliding layer corresponds to the course page of the first subject and the third sliding layer corresponds to the course page of the second subject, and the content displayed on the course page can be changed by sliding up and down on the course page of the first subject or the course page of the second subject, that is, the second sliding layer processes the up and down sliding operations performed on the course page of the first subject to switch the content displayed on the course page of the first subject, and the third sliding layer processes the up and down sliding operations performed on the course page of the second subject to switch the content displayed on the course page of the second subject.
[0033] Specifically, in the configuration page of each sliding layer, the number, priority and preset sliding mode allowed to be executed of each sliding layer are configured in response to the configuration of the number, priority and preset sliding mode allowed to be executed of each sliding layer. Among them, one sliding layer corresponds to one number, and different sliding layers correspond to different numbers, and the numbers are used to distinguish each sliding layer. One sliding layer corresponds to one priority, and the priority of each sliding layer can be the same or different.
[0034] Specifically, the preset sliding mode allowed to be executed corresponding to each sliding layer is any one of the following: horizontal sliding mode, vertical sliding mode and unlocked direction sliding mode. One sliding layer corresponds to one preset sliding mode, and the preset sliding modes allowed to be executed in each sliding layer can be the same or different.
[0035] Furthermore, for each sliding layer, when the sliding layer allows touch sliding, a touch start event, a sliding process event, a sliding end event and a sliding cancel event will be received, and corresponding processing will be performed on the received events.
[0036] Among them, the touch start event of the current touch identifier detected in the sliding layer is determined in the following way: when the touch start event corresponding to the target touch identifier is received, it is determined whether the target touch identifier is an unprocessed touch identifier; when the target touch identifier is an unprocessed touch identifier, the candidate sliding layer set is cleared and the target touch identifier is used as the current touch identifier, so that the touch start event corresponding to the target touch identifier is used as the touch start event of the current touch identifier; when the target touch identifier is a processed touch identifier, the target touch identifier is ignored.
[0037] That is to say, for each sliding layer, when the sliding layer receives a touch start event corresponding to a target touch identifier, it is determined whether the touch start event corresponding to the target touch identifier has been processed by identifying the target touch identifier; if the touch start event corresponding to the target touch identifier has been processed, there is no need to process the received touch start event, and the received touch start event corresponding to the target touch identifier is directly ignored to prevent repeated processing of the touch start event corresponding to a touch identifier; if the touch start event corresponding to the target touch identifier has not been processed, the candidate sliding layer set is cleared, and the candidate sliding layer corresponding to the touch identifier processed last is included in the candidate sliding layer set, and the target touch identifier is directly used as the current touch identifier, and the touch start event corresponding to the target touch identifier is used as the touch start event of the current touch identifier, so that the sliding layer can process the touch start event of the current touch identifier.
[0038] Among them, for each sliding layer, after the sliding layer takes the touch start event corresponding to the target touch identifier as the touch start event of the current touch identifier, at least one candidate sliding layer covering the starting touch position corresponding to the touch start event is determined from the multiple sliding layers corresponding to the user interaction page, and at least one candidate sliding layer is added to the candidate sliding layer set.
[0039] That is to say, for each sliding layer, if the sliding layer covers the starting touch position corresponding to the touch start event, it is considered that the sliding layer can handle the sliding operation corresponding to the current touch identifier, and then the sliding layer is added to the candidate sliding layer set; when the sliding layer does not cover the starting touch position corresponding to the touch start event, the sliding layer cannot handle the sliding operation corresponding to the current touch identifier. Then, each candidate sliding layer in the candidate sliding layer set covers the starting touch position corresponding to the touch start event, and the sliding layer that cannot handle the sliding operation corresponding to the current touch identifier is eliminated through the candidate sliding layer set.
[0040] Furthermore, before adding at least one candidate sliding layer covering the starting touch position corresponding to the touch start event to the candidate sliding layer set, it is also necessary to identify whether the candidate sliding layer set is an empty set; when the candidate sliding layer set is an empty set, at least one candidate sliding layer covering the starting touch position corresponding to the touch start event is added to the candidate sliding layer set, and this means that one sliding layer among the multiple sliding layers of the user interaction page first determines the candidate sliding layer set; when the candidate sliding layer set is not an empty set, it is not processed, which means that one sliding layer among the multiple sliding layers of the user interaction page first determines the candidate sliding layer set, thereby preventing multiple sliding layers from executing the action of determining the candidate sliding layer set and reducing repeated judgments of different sliding layers.
[0041] Exemplarily, each sliding layer corresponds to a running state and a sliding mark. The running state includes a sliding state and a cancel sliding state. The running state is used to describe whether the sliding layer is in the process of executing a touch start event or a sliding process event. The sliding state is used to describe that the sliding layer is in the process of executing a touch start event or a sliding process event. The cancel sliding state is used to describe that the sliding layer is not in the process of executing a touch start event or a sliding process event. The sliding mark includes a sliding mark in the sliding process and a non-sliding mark in the sliding process. The sliding mark is used to describe whether the sliding layer is in the process of executing the sliding process event. The sliding mark is used to describe that the sliding layer is in the process of executing the sliding process event. The non-sliding mark is used to describe that the sliding layer is not in the process of executing the sliding process event.
[0042] Specifically, for each sliding layer, the method further includes: setting the operating state of the sliding layer, wherein the operating state of the sliding layer is set in the following manner: when the sliding layer is added as a candidate sliding layer to the candidate sliding layer set, the operating state of the sliding layer is set to the sliding state.
[0043] That is to say, for each sliding layer, if the sliding layer is added to the candidate sliding layer set as a candidate sliding layer, the operating state of the sliding layer is set to the sliding state; if the sliding layer is not added to the candidate sliding layer set as a candidate sliding layer, it means that the sliding layer does not cover the starting touch position corresponding to the touch start event, and then, the operating state of the sliding layer is set to the canceled sliding state, so that the sliding layer does not need to process the sliding process event of the current touch identifier when it subsequently receives the sliding process event of the current touch identifier, and prevents the sliding layer from processing the sliding operation that cannot be processed.
[0044] Specifically, for each sliding layer, the method further includes: setting a sliding mark of the sliding layer, wherein the sliding mark of the sliding layer is set in the following manner: when the sliding layer is added as a candidate sliding layer to the candidate sliding layer set, the sliding mark of the sliding layer is set to the non-sliding mark.
[0045] That is to say, for each sliding layer, if the sliding layer is added to the candidate sliding layer set as a candidate sliding layer, the sliding mark of the sliding layer is set as a non-sliding mark; if the sliding layer is not added to the candidate sliding layer set as a candidate sliding layer, there is no need to set the sliding mark of the sliding layer.
[0046] For example, see Figure 2 , Figure 2 This is a flow chart of the steps performed by the sliding layer provided in the embodiment of the present application when receiving a touch start event of the current touch identifier. Figure 2 As shown, when the sliding layer receives the touch start event of the current touch identifier, it performs the following processing:
[0047] S201: upon receiving a touch start event corresponding to a target touch identifier, determining whether the target touch identifier is an unprocessed touch identifier.
[0048] S202: Ignore the target touch identifier.
[0049] When the target touch identifier is a processed touch identifier, the target touch identifier is ignored.
[0050] S203: Clear the candidate sliding layer set and use the target touch identifier as the current touch identifier, so as to use the touch start event corresponding to the target touch identifier as the touch start event of the current touch identifier.
[0051] When the target touch identifier is an unprocessed touch identifier, the candidate sliding layer set is cleared and the target touch identifier is used as the current touch identifier, so that the touch start event corresponding to the target touch identifier is used as the touch start event of the current touch identifier.
[0052] S204: Determine whether the candidate sliding layer set is an empty set.
[0053] S205: Add at least one candidate sliding layer covering the start touch position corresponding to the touch start event to the candidate sliding layer set.
[0054] When the candidate sliding layer set is an empty set, at least one candidate sliding layer covering the start touch position corresponding to the touch start event is added to the candidate sliding layer set. When the candidate sliding layer set is not an empty set, step S202 is executed: ignoring the target touch identifier.
[0055] S206: Setting the running state of the candidate sliding layer to the sliding state, and setting the sliding mark of the candidate sliding layer to the non-sliding mark.
[0056] That is to say, for the candidate sliding layers among the multiple sliding layers, the running state of the candidate sliding layer is set to the sliding state and the sliding mark is set to the non-sliding mark; for the sliding layers other than the candidate sliding layers among the multiple sliding layers, the running state of the sliding layer is set to the canceled sliding state, so that after receiving the sliding process event corresponding to the current touch identifier, subsequent operations are only performed on the sliding layer with the running state of the sliding state, thereby preventing the sliding layer from operating on the sliding process event that cannot be executed.
[0057] return Figure 1, S102: receiving a sliding process event corresponding to the current touch identifier in the sliding layer, determining a target sliding direction according to a sliding vector corresponding to the sliding process event, and determining whether the sliding layer is the same as a preset sliding layer in the candidate sliding layer set.
[0058] The preset sliding layer is used to indicate the first numbered candidate sliding layer with the highest priority that matches the preset sliding mode with the target sliding direction.
[0059] For example, see Figure 3 , Figure 3 This is a flow chart of the steps performed by the sliding layer provided in the embodiment of the present application when receiving the sliding process event of the current touch mark. Figure 2 As shown, when the sliding layer receives the sliding process event of the current touch identifier, it performs the following processing:
[0060] S301: When the sliding layer receives a sliding process event corresponding to the current touch identifier, determining whether the operating state of the sliding layer is the sliding state.
[0061] That is to say, for each sliding layer, after the sliding layer receives the touch start event corresponding to the current touch identifier, when it receives the sliding process event corresponding to the current touch identifier, it is determined whether the operating state of the sliding layer is the sliding state, so as to distinguish whether the sliding layer covers the starting touch position corresponding to the touch start event through the sliding state. And when it is determined that the operating state of the sliding layer is not the sliding state, but is in the cancel sliding state, it means that the sliding layer does not cover the starting touch position corresponding to the touch start event, and then, the sliding layer does not need to perform subsequent processing.
[0062] S302: Determine whether the sliding mark of the sliding layer is the non-sliding mark.
[0063] For each sliding layer, when the sliding layer receives a sliding process event corresponding to the current touch identifier, the method also includes: determining a sliding mark of the sliding layer, the sliding mark including a sliding mark in progress and a non-sliding mark not in the sliding process; when the sliding mark of the sliding layer is the non-sliding mark, determining a target sliding direction according to a sliding vector corresponding to the sliding process event; and when the sliding mark of the sliding layer is the sliding mark, triggering a sliding operation corresponding to the sliding process event.
[0064] When the operating state of the sliding layer is the sliding state, it is necessary to determine the sliding mark of the sliding layer. That is, when it is determined that the sliding layer covers the starting touch position corresponding to the touch start event, the sliding mark of the sliding layer is determined, and the sliding mark is used to prevent repeated determination of whether the sliding layer is the same as the preset sliding layer.
[0065] That is to say, the sliding mark is used to distinguish whether the sliding layer receives the sliding process event corresponding to the current touch identifier for the first time. If the sliding process event corresponding to the current touch identifier is received for the first time, the sliding mark of the sliding layer is the no-sliding mark. If it is not the first time that the sliding process event corresponding to the current touch identifier is received, the sliding mark of the sliding layer is the sliding mark.
[0066] S303: triggering a sliding operation corresponding to the sliding process event.
[0067] When the sliding mark of the sliding layer is the sliding mark, the sliding operation corresponding to the sliding process event is triggered. That is, when it is determined that the sliding mark of the sliding layer is the sliding mark, it is considered that the sliding layer has been pre-identified as the same as the preset sliding layer, and the sliding layer performs the sliding operation corresponding to the sliding process event, thereby changing the content displayed on the user interaction page.
[0068] S304: Determine a target sliding direction according to the sliding vector corresponding to the sliding process event.
[0069] When the sliding mark of the sliding layer is the non-sliding mark, the target sliding direction is determined according to the sliding vector corresponding to the sliding process event.
[0070] The determining of the target sliding direction according to the sliding vector corresponding to the sliding process event includes: obtaining the sliding vector from the starting touch position to the current sliding position in real time during the sliding process of the sliding operation corresponding to the sliding process event; determining whether the sliding length of the sliding vector is greater than a preset vector length; when the sliding length of the sliding vector is greater than the preset vector length, determining a first coordinate length in a first direction and a second coordinate length in a second direction of the current sliding position corresponding to the sliding vector, wherein the first direction is one of a horizontal direction and a vertical direction, and the second direction is the other of the horizontal direction and the vertical direction; and determining whether the target sliding direction is a horizontal direction or a vertical direction according to a comparison result of the first coordinate length and the second coordinate length.
[0071] The preset sliding modes allowed to be executed corresponding to each sliding layer are any one of the following: horizontal sliding mode, vertical sliding mode and unlocked direction sliding mode, wherein when the target sliding direction is horizontal, the preset sliding modes matching the sliding layer in the horizontal direction include horizontal sliding mode and unlocked direction sliding mode, and when the target sliding direction is vertical, the preset sliding modes matching the sliding layer in the vertical direction include vertical sliding mode and unlocked direction sliding mode.
[0072] That is, when the operating state of the sliding layer is the sliding state and the sliding mark of the sliding layer is the non-sliding mark, the sliding length of the sliding vector from the starting touch position to the current sliding position is identified, and the sliding length is used to distinguish whether the sliding vector corresponds to a valid sliding operation. When the sliding length of the sliding vector is less than or equal to the preset vector length, it is considered that the sliding vector may be a false touch or click operation, rather than a valid sliding operation; when the sliding length of the sliding vector is greater than the preset vector length, it is considered that the sliding vector corresponds to a valid sliding operation. Exemplarily, the preset vector length is generally set to a length of 7 pixels.
[0073] Among them, when the sliding length of the sliding vector is greater than the preset vector length, the first coordinate length of the sliding vector in the first direction and the second coordinate length of the sliding vector in the second direction are compared. When the first coordinate length is greater than the second coordinate length, the target sliding direction is considered to be the first direction. When the first coordinate length is less than or equal to the second coordinate length, the target sliding direction is considered to be the second direction.
[0074] Exemplarily, if the first direction is a horizontal direction and the second direction is a vertical direction, when the first coordinate length in the horizontal direction is greater than the second coordinate length in the vertical direction, the target sliding direction is considered to be a horizontal direction; when the first coordinate length in the horizontal direction is less than or equal to the second coordinate length in the vertical direction, the target sliding direction is considered to be a vertical direction.
[0075] Then, after determining the target sliding direction of the sliding vector, a sliding layer matching the target sliding direction is determined in the candidate sliding layer set. Exemplarily, if the target sliding direction is a horizontal direction, a sliding layer whose preset sliding mode is a horizontal sliding mode and a sliding layer whose preset sliding mode is a sliding mode that does not lock the direction are selected as sliding layers matching the horizontal direction in the candidate sliding layer set; if the target sliding direction is a vertical direction, a sliding layer whose preset sliding mode is a vertical sliding mode and a sliding layer whose preset sliding mode is a sliding mode that does not lock the direction are selected as sliding layers matching the vertical direction in the candidate sliding layer set.
[0076] S305: Determine whether the sliding layer is the same as a preset sliding layer in the candidate sliding layer set.
[0077] For each sliding layer, after determining whether the sliding layer is the same as the preset sliding layer of the candidate sliding layer set, the method also includes: when the sliding layer is the same as the preset sliding layer of the candidate sliding layer set, changing the sliding mark of the sliding layer from the non-sliding mark to the sliding mark; when the sliding layer is not the same as the preset sliding layer of the candidate sliding layer set, the sliding layer triggers the sliding cancel event corresponding to the current touch identifier.
[0078] That is, for each sliding layer, a sliding layer with the highest priority and the smallest number is selected from the sliding layers matching the target sliding direction determined in the candidate sliding layer set.
[0079] Exemplarily, if the candidate sliding layer set includes the first sliding layer, the second sliding layer, and the third sliding layer, which are sorted from small to large in number, and the priorities of the second sliding layer and the third sliding layer are the same and lower than the priority of the first sliding layer. The target sliding direction is the vertical direction, the preset sliding mode of the first sliding layer is the horizontal sliding mode, the preset sliding mode of the second sliding layer is the vertical sliding direction, and the preset sliding mode of the third sliding layer is the vertical sliding mode. Then, the preset sliding layer matching the target sliding direction is the second sliding layer.
[0080] S306: Modify the sliding mark of the sliding layer from the non-sliding mark to the sliding mark.
[0081] When the sliding layer is the same as the preset sliding layer of the candidate sliding layer set, the sliding mark of the sliding layer is changed from the non-sliding mark to the sliding mark. In other words, when the sliding layer is the preset sliding layer, it means that the sliding process event corresponding to the current touch identifier is executed in the sliding layer, and the displayed page content is changed in response to the sliding operation corresponding to the sliding vector, and then the sliding mark of the sliding layer is changed from the non-sliding mark to the sliding mark, so that when the sliding layer continues to receive the sliding process event corresponding to the current touch identifier, the sliding mark of the sliding layer is determined to be the sliding mark, and the sliding operation can be directly responded to without determining whether the sliding layer is the preset sliding layer.
[0082] S307: The sliding layer triggers a sliding cancel event corresponding to the current touch marker.
[0083] When the sliding layer is different from the preset sliding layer of the candidate sliding layer set, the sliding layer triggers the sliding cancel event corresponding to the current touch identifier. In other words, when the sliding layer is determined not to be the preset sliding layer, the sliding layer does not need to process the sliding process event corresponding to the current touch identifier, and directly triggers the sliding cancel event corresponding to the current touch identifier.
[0084] return Figure 1 , S103: triggering a sliding operation corresponding to the sliding process event, so that the user interaction page displays the sliding page content corresponding to the sliding operation triggered on the sliding layer.
[0085] When the sliding layer is the same as the preset sliding layer of the candidate sliding layer set, the sliding operation corresponding to the sliding process event is triggered, so that the user interaction page displays the sliding page content corresponding to the sliding operation triggered on the sliding layer.
[0086] Exemplarily, when the sliding layer is the same as the preset sliding layer of the candidate sliding layer set, the sliding mark of the sliding layer is changed from the not-sliding mark to the sliding mark, and then, when the sliding layer subsequently receives a sliding process event corresponding to the current touch identifier, the sliding mark of the sliding layer is identified as the sliding mark, and the sliding operation corresponding to the sliding process event is triggered, thereby controlling the user interaction page to move the page content displayed according to the sliding operation triggered on the sliding layer.
[0087] When the sliding layer detects a sliding end event corresponding to the current touch identifier, the method further includes: when the operating state of the sliding layer is the sliding cancellation state, determining whether the candidate sliding layer set is an empty set.
[0088] That is to say, for each sliding layer, when the sliding layer detects the sliding end event corresponding to the current touch identifier, the operating state of the sliding layer is set to the cancel sliding state, so as to determine whether the candidate sliding layer set is an empty set.
[0089] Furthermore, for each sliding layer, when the sliding layer is the sliding layer for performing the sliding operation, that is, when the sliding layer is the preset sliding layer corresponding to the sliding process event of the current touch identifier, the sliding process is ended and the sliding mark is set to the non-sliding mark.
[0090] For each sliding layer, the method also includes: when the sliding layer detects the sliding end event corresponding to the current touch identifier, determining whether the candidate sliding layer set is an empty set; if the candidate sliding layer set is not an empty set, determining whether the sliding marks corresponding to the multiple sliding layers corresponding to the user interaction page are all in the non-sliding mark; if the sliding marks corresponding to the multiple sliding layers are all in the non-sliding mark, determining whether the sliding layer is the same as the target sliding layer in the candidate sliding layer set, the target sliding layer is the first numbered candidate sliding layer with the highest priority in the candidate sliding layer set; when the sliding layer is the same as the target sliding layer in the candidate sliding layer set, determining that the sliding end event corresponding to the current touch identifier is a click event, and triggering the touch operation corresponding to the click event, so that the user interaction page displays the page content after the click according to the touch operation triggered on the sliding layer.
[0091] That is to say, for each sliding layer, when it is determined that the candidate sliding layer set is not an empty set and the sliding marks corresponding to the multiple sliding layers corresponding to the user interaction page are all in the non-sliding mark, it means that the sliding end event corresponding to the current touch identifier received by the sliding layer may be a click event, and then, it is determined whether the target sliding layer with the highest priority and the smallest number in the candidate sliding layer is the sliding layer. If so, it means that the sliding end event corresponding to the current touch identifier received by the sliding layer is a click event. If not, the click event is not executed. That is, when it is determined that the target sliding layer with the highest priority and the smallest number is the sliding layer in at least one candidate sliding layer covering the starting touch position corresponding to the touch start event, the click event is executed on the sliding layer, and the corresponding click position of the user interaction page is controlled to realize page jump.
[0092] That is to say, for each sliding layer, when it is determined that the candidate sliding layer set is not an empty set, it means that there is at least one candidate sliding layer that meets the starting touch position, that is, there is a starting touch position, and the sliding layer may execute a click event; when it is determined that the candidate sliding layer set is an empty set, it means that there is no sliding layer that meets the starting touch position, that is, the starting touch position has not been received, and no subsequent processing is required. For each sliding layer, when it is determined that the candidate sliding layer set is not an empty set, and the sliding mark corresponding to any sliding layer corresponding to the user interaction page is in the sliding mark, it means that a sliding layer in the candidate sliding layer set is performing a sliding operation, and the sliding layer that receives the sliding end event is not the sliding layer that performs the sliding operation, then the sliding mark of the sliding layer is set to the non-sliding mark.
[0093] For each sliding layer, the method also includes: setting the operating state of the sliding layer, the operating state including a sliding state and a cancel sliding state, wherein the operating state of the sliding layer is set in the following manner: when the sliding layer triggers a sliding cancel event corresponding to the current touch identifier, the operating state of the sliding layer is set to the cancel sliding state.
[0094] That is to say, for each sliding layer, when the sliding layer triggers the sliding cancellation event corresponding to the current touch identifier, the operating state of the sliding layer is set to the cancel sliding state, and the sliding mark of the sliding layer is set to the non-sliding mark to prevent the sliding layer from repeatedly performing operations and affecting resource utilization.
[0095] Based on the same application concept, see Figure 4As shown, it is a structural diagram of an electronic device provided in an embodiment of the present application, the electronic device 20 includes: a processor 201, a memory 202 and a bus 203, the memory 202 stores machine-readable instructions executable by the processor 201, when the electronic device 20 is running, the processor 201 communicates with the memory 202 through the bus 203, and the machine-readable instructions are executed by the processor 201 when it is running, as in the steps of the page processing method described in any of the above embodiments.
[0096] Specifically, when the machine-readable instructions are executed by the processor 201, the following processing can be performed: for each sliding layer, when the sliding layer detects a touch start event of the current touch identifier, if the sliding layer will cover at least one candidate of the start touch position corresponding to the touch start event, the sliding layer is added to the candidate sliding layer set, and a sliding process event corresponding to the current touch identifier is received at the sliding layer, and a target sliding direction is determined according to a sliding vector corresponding to the sliding process event, and it is determined whether the sliding layer is the same as a preset sliding layer in the candidate sliding layer set. The preset sliding layer is used to indicate the first candidate sliding layer with the highest priority that matches the preset sliding mode and the target sliding direction. When the sliding layer is the same as the preset sliding layer in the candidate sliding layer set, the sliding operation corresponding to the sliding process event is triggered, so that the user interaction page displays the sliding page content according to the sliding operation triggered on the sliding layer.
[0097] Based on the same application concept, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the page processing method provided in the above embodiment are executed.
[0098] Specifically, the storage medium can be a general storage medium, such as a mobile disk, a hard disk, etc. When the computer program on the storage medium is run, the above-mentioned page processing method can be executed. By pre-configuring the sliding layer's label, priority and preset sliding mode allowed to be executed, when each sliding layer receives a touch start event of a touch identifier, the candidate sliding layer that can execute the touch operation corresponding to the touch identifier is first determined according to the range covered by the sliding layer and the candidate sliding layer is placed in a candidate sliding layer set. In this way, when each sliding layer receives a sliding process event corresponding to the current touch identifier, it is determined whether the first labeled candidate sliding layer with the highest priority that can execute the sliding process event in the candidate sliding layer set is the sliding layer. If so, the sliding layer changes the displayed user interaction page corresponding to the sliding operation corresponding to the sliding process event, thereby solving the technical problem in the prior art that multiple sliding layers respond to the sliding operation to change the displayed content of the control page, thereby achieving the technical effect of increasing the accuracy of sliding processing and reducing resource occupancy.
[0099] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, the specific working process of the system and device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here. In the several embodiments provided in the present application, it should be understood that the disclosed system, device and method can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0100] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0101] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0102] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc., various media that can store program codes.
[0103] The above are only specific implementations of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A page processing method, characterized in that: A user interaction page is provided through a terminal device, the user interaction page corresponds to a plurality of sliding layers, each sliding layer includes a pre-configured label, a priority and a preset sliding mode allowed to be executed, and the method includes: For each sliding layer, when the sliding layer detects a touch start event of the current touch identifier, at least one candidate sliding layer covering the start touch position corresponding to the touch start event is added to the candidate sliding layer set; For each sliding layer, a sliding process event corresponding to the current touch identifier is received at the sliding layer, a target sliding direction is determined according to a sliding vector corresponding to the sliding process event, and it is determined whether the sliding layer is the same as a preset sliding layer of the candidate sliding layer set, wherein the preset sliding layer is used to indicate the first candidate sliding layer with the highest priority whose preset sliding mode matches the target sliding direction; For each sliding layer, when the sliding layer is the same as the preset sliding layer of the candidate sliding layer set, the sliding operation corresponding to the sliding process event is triggered, so that the user interaction page displays the sliding page content according to the sliding operation triggered on the sliding layer.
2. The method according to claim 1, characterized in that: The determining the target sliding direction according to the sliding vector corresponding to the sliding process event includes: During the sliding process of the sliding operation corresponding to the sliding process event, a sliding vector from the starting touch position to the current sliding position is acquired in real time; Determining whether the sliding length of the sliding vector is greater than a preset vector length; When the sliding length of the sliding vector is greater than the preset vector length, determining a first coordinate length in a first direction and a second coordinate length in a second direction of the current sliding position corresponding to the sliding vector, wherein the first direction is one of a horizontal direction and a vertical direction, and the second direction is the other of the horizontal direction and the vertical direction; According to the comparison result of the first coordinate length and the second coordinate length, it is determined that the target sliding direction is a horizontal direction or a vertical direction.
3. The method according to claim 2, characterized in that The preset sliding modes allowed for each sliding layer are any of the following: horizontal sliding mode, vertical sliding mode, and sliding mode without locking the direction. Wherein, when the target sliding direction is a horizontal direction, the preset sliding mode matching the sliding layer in the horizontal direction includes a horizontal sliding mode and an unlocked direction sliding mode. When the target sliding direction is a vertical direction, the preset sliding modes matching the sliding layer in the horizontal direction include a vertical sliding mode and an unlocked direction sliding mode.
4. The method according to claim 1, characterized in that: The touch start event of the current touch identifier detected in the sliding layer is determined in the following way: When receiving a touch start event corresponding to a target touch identifier, determining whether the target touch identifier is an unprocessed touch identifier; When the target touch identifier is an unprocessed touch identifier, clear the candidate sliding layer set and use the target touch identifier as the current touch identifier, so as to use the touch start event corresponding to the target touch identifier as the touch start event of the current touch identifier; When the target touch identifier is a processed touch identifier, the target touch identifier is ignored.
5. The method according to claim 1, characterized in that For each sliding layer, when the sliding layer receives a sliding process event corresponding to the current touch identifier, the method further includes: Determine a sliding mark of the sliding layer, wherein the sliding mark includes a sliding mark in a sliding process and a non-sliding mark not in a sliding process, When the sliding mark of the sliding layer is the non-sliding mark, the target sliding direction is determined according to the sliding vector corresponding to the sliding process event, When the sliding mark of the sliding layer is the sliding mark, a sliding operation corresponding to the sliding process event is triggered.
6. The method according to claim 5, characterized in that After determining for each sliding layer whether the sliding layer is the same as a preset sliding layer in the candidate sliding layer set, the method further includes: When the sliding layer is the same as the preset sliding layer of the candidate sliding layer set, the sliding mark of the sliding layer is changed from the non-sliding mark to the sliding mark, When the sliding layer is different from the preset sliding layer of the candidate sliding layer set, the sliding layer triggers the sliding cancel event corresponding to the current touch identifier.
7. The method according to claim 6, characterized in that For each sliding layer, the method further comprises: When the sliding layer detects a sliding end event corresponding to the current touch identifier, determining whether the candidate sliding layer set is an empty set, If the candidate sliding layer set is not an empty set, determining whether the sliding marks respectively corresponding to the plurality of sliding layers corresponding to the user interaction page are all at the non-sliding mark, If the sliding marks corresponding to the plurality of sliding layers are all at the non-sliding mark, it is determined whether the sliding layer is the same as the target sliding layer in the candidate sliding layer set, and the target sliding layer is the first numbered candidate sliding layer with the highest priority in the candidate sliding layer set. When the sliding layer is the same as the target sliding layer in the candidate sliding layer set, the sliding end event corresponding to the current touch identifier is determined to be a click event, and the touch operation corresponding to the click event is triggered, so that the user interaction page displays the page content after the click according to the touch operation triggered on the sliding layer.
8. The method according to claim 6, characterized in that For each sliding layer, the method further comprises: Set the operating state of the sliding layer, the operating state includes a sliding state and a cancel sliding state, The operating state of the sliding layer is set in the following manner: When the sliding layer is added as a candidate sliding layer to the candidate sliding layer set, the operating state of the sliding layer is set to the sliding state, When the sliding layer triggers the sliding cancel event corresponding to the current touch identifier, the running state of the sliding layer is set to the sliding cancel state.
9. An electronic device, characterized in that: include: A processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the memory communicate through the bus, and the machine-readable instructions are executed by the processor to execute the steps of the page processing method as described in any one of claims 1 to 8.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the page processing method according to any one of claims 1 to 8 are executed.