Sliding event processing method and device, electronic equipment and storage medium

By analyzing the trend of the absolute value change of scrolling volume in the swipe event queue, and setting thresholds and time differences, the problem of low swipe response accuracy of touchpad devices was solved, achieving higher response accuracy and user experience.

CN122240358APending Publication Date: 2026-06-19BEIJING QIYI CENTURY SCI & TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BEIJING QIYI CENTURY SCI & TECH CO LTD
Filing Date
2026-03-26
Publication Date
2026-06-19

AI Technical Summary

Technical Problem

Existing touchpad devices suffer from low accuracy in swiping response due to hardware differences and operating system event handling mechanisms. This results in a significant discrepancy between user expectations and actual performance, thus reducing the user experience.

Method used

By acquiring the swipe event queue, calculating the average absolute value of the scroll amount of each swipe event, analyzing the relative trend of scroll amount changes, determining the user's swipe operation intent, setting preset thresholds and time differences, blocking unnecessary swipe event triggers, and improving response accuracy.

🎯Benefits of technology

Eliminate the impact of differences in the absolute value of scrolling across different devices, reduce unnecessary swipe event triggering, improve swipe response speed and interaction accuracy, and enhance user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122240358A_ABST
    Figure CN122240358A_ABST
Patent Text Reader

Abstract

This invention provides a method, apparatus, electronic device, and storage medium for handling swipe events, relating to the field of human-computer interaction technology. A first average value is obtained by calculating the average of the absolute values ​​of the scroll amounts of all swipe events in a first set; a second average value is obtained by calculating the average of the absolute values ​​of the scroll amounts of all swipe events in a second set. The first set is a set of a first preset number of swipe events most recent to the current time, and the second set is a set of a second preset number of swipe events most recent to the current time. The first preset number is less than the second preset number. It is determined whether the first average value is not greater than the second average value; if so, a swipe operation is not triggered. Applying this invention can eliminate the influence of differences in the absolute values ​​of scroll amounts between different devices, thereby improving the accuracy of swipe response and enhancing the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of human-computer interaction technology, and in particular to a sliding event processing method, apparatus, electronic device, and storage medium. Background Technology

[0002] With the widespread adoption of laptops and related smart devices, touchpads have become an important human-computer interaction tool. Using a touchpad, users can control the mouse cursor on the screen by moving their fingers and trigger swipe operations to scroll through pages, browse content, and control applications. For example, on PC (Personal Computer) devices, in today's popular immersive playback scenarios, users can slide their fingers across the touchpad to switch between videos.

[0003] Currently, most touchpad devices on the market utilize swipe events, such as wheel events, from the operating system's underlying application programming interface (API) to capture swipe gestures. However, due to differences in device hardware, operating system event handling mechanisms, and the diversity of human-computer interaction, in practical applications, a single swipe operation can trigger multiple swipe events. This results in low accuracy of the swipe response, leading to a significant discrepancy between the actual swipe effect and the user's expected operation, thus reducing the user experience. Summary of the Invention

[0004] The purpose of this invention is to provide a sliding event processing method, apparatus, electronic device, and storage medium to improve the accuracy of sliding response. The specific technical solution is as follows:

[0005] In a first aspect of this invention, a sliding event handling method is provided, the method comprising:

[0006] Obtain a swipe event queue, wherein the swipe event queue is constructed based on various swipe events generated by the user's swipe operation, and the swipe event includes the scroll amount generated by the swipe event along the screen swipe direction and the timestamp of the swipe event;

[0007] Based on each timestamp, obtain a first preset number of swipe events closest to the current time to obtain a first set, and obtain a second preset number of swipe events closest to the current time to obtain a second set; the first preset number is less than the second preset number.

[0008] Calculate the average of the absolute values ​​of the scroll amounts of all swipe events in the first set to obtain a first average; calculate the average of the absolute values ​​of the scroll amounts of all swipe events in the second set to obtain a second average.

[0009] Determine whether the first average value is not greater than the second average value; if so, do not trigger the current sliding event.

[0010] In one possible implementation, the method further includes:

[0011] If the first average value is greater than the second average value, the sliding increase amplitude is determined based on the first average value and the second average value, wherein the sliding increase amplitude represents the increase of the first average value relative to the second average value;

[0012] If the upward sliding amplitude is not greater than a preset amplitude threshold, the current sliding event will not be triggered.

[0013] In one possible implementation, the method further includes:

[0014] If the sliding increase is greater than a preset threshold, determine whether there is a sliding event that has been triggered in response to the sliding operation. If not, trigger the current sliding event.

[0015] If it exists, calculate the difference between the first timestamp and the second timestamp to obtain the first time difference; wherein, the first timestamp is the timestamp of the current swipe event, and the second timestamp is the timestamp of the swipe event triggered by the swipe operation closest to the current time;

[0016] Determine whether the first time difference is less than a preset time difference. If yes, do not trigger the current swipe event; otherwise, trigger the current swipe event.

[0017] In one possible implementation, the method for determining the preset time difference includes:

[0018] A preset first sliding event interval is set, which represents the time difference between the trigger times of two preset sliding events;

[0019] Based on each of the timestamps, obtain the third preset number of sliding events closest to the current time to obtain the third set;

[0020] Based on the sliding event closest to the current time, the sliding event farthest from the current time in the third set, and the third preset quantity, the average sliding event interval is calculated. The average sliding event interval represents the sliding event triggering frequency of the target device, and the target device is the device that responds to the sliding operation.

[0021] The frequency type of the target device for triggering the sliding event frequency is determined based on the average sliding event interval;

[0022] Set the first adjustment coefficient according to the frequency type;

[0023] The preset time difference is obtained by multiplying the first sliding event interval by the first adjustment coefficient.

[0024] In one possible implementation, the preset amplitude threshold is determined by:

[0025] Set the preset first amplitude threshold;

[0026] Based on each of the timestamps, obtain the fourth preset number of sliding events closest to the current time to obtain the fourth set;

[0027] Calculate the average of the absolute values ​​of the scrolling amount of all sliding events in the fourth set to obtain a third average value, which characterizes the magnitude of the scrolling amount change of the sliding events of the target device;

[0028] The type of rolling volume for the target device in response to the rolling volume change range is determined based on the third average value;

[0029] Set a second adjustment factor according to the rolling amount type;

[0030] The preset amplitude threshold is obtained by multiplying the first amplitude threshold by the second adjustment coefficient.

[0031] In one possible implementation, acquiring the sliding event queue includes:

[0032] Get all swipe events generated by the user's swipe actions;

[0033] For each swipe event, determine whether the scroll amount and timestamp of the swipe event are in the preset data format; if so, determine that the data format of the swipe event is incorrect and do not store the swipe event in the swipe event queue.

[0034] If not, then determine whether the timestamp of the current sliding event is less than the timestamp of the previous stored sliding event; if so, then do not store the current sliding event in the sliding event queue.

[0035] If not, determine whether the interval between the timestamp of the current sliding event and the timestamp of the previous sliding event is greater than a preset time interval; if so, do not store the sliding event in the sliding event queue.

[0036] If not, determine whether the absolute value of the scroll amount of the swipe event is less than the preset scroll amount threshold; if so, do not store the swipe event in the swipe event queue.

[0037] If not, the sliding event is stored in the sliding event queue, thus obtaining the sliding event queue.

[0038] In one possible implementation, after obtaining the sliding event queue, the method further includes:

[0039] Calculate the average of the absolute values ​​of the scroll amounts of the fifth preset number of sliding events in the sliding event queue that are closest to the current time, and obtain the fourth average value;

[0040] For each sliding event in the sliding event queue, determine whether the absolute value of the scrolling amount of the sliding event is greater than a first preset multiple of the fourth average value, or whether the absolute value of the scrolling amount of the sliding event is less than a preset proportion of the fourth average value, wherein the preset multiple is greater than 1 and the preset proportion is less than 1; if so, remove the sliding event from the sliding event queue.

[0041] If not, if the first absolute value is not 0, determine whether the first scroll amount difference is greater than a second preset multiple of the first absolute value, wherein the second preset multiple is greater than 1; if yes, remove the scroll event from the scroll event queue; wherein the first scroll amount difference is the difference between the absolute value of the scroll amount of the scroll event and the scroll amount of the previous scroll event, and the first absolute value is the absolute value of the scroll amount of the scroll event furthest from the current time in the scroll event queue;

[0042] If not, the slide event is retained in the slide event queue.

[0043] In a second aspect of the present invention, a sliding event handling apparatus is first provided, the apparatus comprising:

[0044] The first acquisition module is used to acquire a sliding event queue, wherein the sliding event queue is constructed based on various sliding events generated by the user's sliding operation, and the sliding event includes the scroll amount generated by the sliding event along the screen sliding direction and the timestamp of the sliding event;

[0045] The second acquisition module is used to acquire, based on each timestamp, a first preset number of swipe events closest to the current time to obtain a first set, and to acquire a second preset number of swipe events closest to the current time to obtain a second set; the first preset number is less than the second preset number.

[0046] The first calculation module is used to calculate the average of the absolute values ​​of the scrolling amounts of all sliding events in the first set to obtain a first average value; and to calculate the average of the absolute values ​​of the scrolling amounts of all sliding events in the second set to obtain a second average value.

[0047] The first processing module is used to determine whether the first average value is not greater than the second average value; if so, the current sliding event is not triggered.

[0048] In one possible implementation, the device further includes:

[0049] The second processing module is configured to determine the sliding increase amplitude based on the first average value and the second average value if the first average value is greater than the second average value, wherein the sliding increase amplitude represents the increase of the first average value relative to the second average value.

[0050] The third processing module is used to prevent the current sliding event from being triggered if the sliding increase is not greater than a preset threshold.

[0051] In one possible implementation, the device further includes:

[0052] The fourth processing module is used to determine whether there is a sliding event that has been triggered in response to the sliding operation when the sliding increase is greater than a preset threshold. If there is no sliding event, the current sliding event is triggered.

[0053] The fifth processing module is used to calculate the difference between the first timestamp and the second timestamp, if they exist, to obtain the first time difference; wherein the first timestamp is the timestamp of the current sliding event, and the second timestamp is the timestamp of the sliding event triggered by the most recent sliding operation.

[0054] The sixth processing module is used to determine whether the first time difference is less than a preset time difference. If it is, the current sliding event is not triggered; otherwise, the current sliding event is triggered.

[0055] In one possible implementation, the device further includes:

[0056] The module for determining the preset time difference is used to determine the preset time difference; it includes:

[0057] The first setting submodule is used to set a preset first sliding event interval, wherein the first sliding event interval represents the time difference between the trigger times of two preset sliding events;

[0058] The first acquisition submodule is used to acquire a third preset number of sliding events that are closest to the current time based on each of the timestamps, and obtain a third set;

[0059] The first calculation submodule is used to calculate the average sliding event interval based on the sliding event closest to the current time, the sliding event farthest from the current time in the third set, and the third preset quantity. The average sliding event interval represents the sliding event triggering frequency of the target device, and the target device is the device that responds to the sliding operation.

[0060] The first determining submodule is used to determine the frequency type of the target device in response to the sliding event triggering frequency based on the average sliding event interval;

[0061] The second setting submodule is used to set a first adjustment coefficient according to the frequency type;

[0062] The second calculation submodule is used to calculate the product of the first sliding event interval and the first adjustment coefficient to obtain the preset time difference.

[0063] In one possible implementation, the device further includes: a module for determining a preset time difference, used to determine the preset amplitude threshold, including:

[0064] The third setting submodule is used to set the preset first amplitude threshold;

[0065] The second acquisition submodule is used to acquire the fourth preset number of sliding events closest to the current time based on each of the timestamps, and obtain a fourth set;

[0066] The third calculation submodule is used to calculate the average of the absolute values ​​of the scrolling amount of all sliding events in the fourth set to obtain a third average value, which represents the magnitude of the scrolling amount change of the sliding events of the target device.

[0067] The second determining submodule is used to determine the type of scrolling amount of the target device in response to the scrolling amount change range based on the third average value;

[0068] The fourth setting submodule is used to set a second adjustment coefficient according to the scrolling amount type;

[0069] The fourth calculation submodule is used to calculate the product of the first amplitude threshold and the second adjustment coefficient to obtain the preset amplitude threshold.

[0070] In one possible implementation, the first acquisition module is specifically used for:

[0071] Get all swipe events generated by the user's swipe actions;

[0072] For each swipe event, determine whether the scroll amount and timestamp of the swipe event are in the preset data format; if so, determine that the data format of the swipe event is incorrect and do not store the swipe event in the swipe event queue.

[0073] If not, then determine whether the timestamp of the current sliding event is less than the timestamp of the previous stored sliding event; if so, then do not store the current sliding event in the sliding event queue.

[0074] If not, determine whether the interval between the timestamp of the current sliding event and the timestamp of the previous sliding event is greater than a preset time interval; if so, do not store the sliding event in the sliding event queue.

[0075] If not, determine whether the absolute value of the scroll amount of the swipe event is less than the preset scroll amount threshold; if so, do not store the swipe event in the swipe event queue.

[0076] If not, the sliding event is stored in the sliding event queue, thus obtaining the sliding event queue.

[0077] In one possible implementation, the device further includes a building module for:

[0078] After obtaining the sliding event queue, calculate the average of the absolute values ​​of the scroll amounts of the fifth preset number of sliding events in the sliding event queue that are closest to the current time, and obtain the fourth average value;

[0079] For each sliding event in the sliding event queue, determine whether the absolute value of the scrolling amount of the sliding event is greater than a first preset multiple of the fourth average value, or whether the absolute value of the scrolling amount of the sliding event is less than a preset proportion of the fourth average value, wherein the preset multiple is greater than 1 and the preset proportion is less than 1; if so, remove the sliding event from the sliding event queue.

[0080] If not, if the first absolute value is not 0, determine whether the first scroll amount difference is greater than a second preset multiple of the first absolute value, wherein the second preset multiple is greater than 1; if yes, remove the scroll event from the scroll event queue; wherein the first scroll amount difference is the difference between the absolute value of the scroll amount of the scroll event and the scroll amount of the previous scroll event, and the first absolute value is the absolute value of the scroll amount of the scroll event furthest from the current time in the scroll event queue;

[0081] If not, the slide event is retained in the slide event queue.

[0082] In another aspect of the present invention, an electronic device is also provided, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus.

[0083] Memory, used to store computer programs;

[0084] When a processor executes a program stored in memory, it implements any of the steps described in the first aspect.

[0085] In another aspect of the present invention, a computer-readable storage medium is also provided, wherein a computer program is stored therein, and when the computer program is executed by a processor, it implements any of the sliding event handling methods described above.

[0086] In another aspect of the present invention, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to execute any of the sliding event processing methods described above.

[0087] The sliding event handling method provided in this embodiment of the invention calculates a first average value by averaging the absolute values ​​of the scroll amounts of all sliding events in a first set, and a second average value by averaging the absolute values ​​of the scroll amounts of all sliding events in a second set. The first set is a set of a first preset number of sliding events closest to the current time, and the second set is a set of a second preset number of sliding events closest to the current time. The first preset number is less than the second preset number. The method determines whether the first average value is not greater than the second average value; if so, no sliding operation is triggered. In other words, the sliding event handling method provided in this embodiment of the invention does not rely on the absolute value of the scroll amount, but rather determines the user's intention to slide by analyzing the relative trend of the absolute value of the scroll amount. If the first average value is not greater than the second average value, it indicates that the relative trend of the absolute value of the scroll amount is not upward, and the device will not trigger a sliding operation. This eliminates the influence of differences in the absolute values ​​of scroll amounts between different devices, thereby improving the accuracy of the sliding response. It also avoids excessive sliding, reducing response latency, improving device response speed and interaction accuracy, and enhancing the user experience. Attached Figure Description

[0088] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below.

[0089] Figure 1 This is a flowchart illustrating a sliding event handling method provided in an embodiment of the present invention;

[0090] Figure 2This is another flowchart illustrating the sliding event handling method provided in an embodiment of the present invention;

[0091] Figure 3 This is another flowchart illustrating the sliding event handling method provided in an embodiment of the present invention;

[0092] Figure 4 This is a schematic diagram of a sliding event processing device provided in an embodiment of the present invention;

[0093] Figure 5 This is a schematic diagram of an electronic device provided in an embodiment of the present invention. Detailed Implementation

[0094] The technical solutions of the present invention will now be described with reference to the accompanying drawings in the embodiments of the present invention.

[0095] This invention provides a sliding event processing method, apparatus, electronic device, and storage medium to improve the accuracy of sliding response.

[0096] First, the sliding event handling method provided in the embodiments of the present invention will be introduced. This method is applied to a server, which can be any electronic device that can provide sliding event handling services, such as a computer, mobile phone, tablet computer, etc., without specific limitations. The sliding event handling method provided in the embodiments of the present invention can be implemented in at least one of software, hardware circuits, and logic circuits in an electronic device.

[0097] The specific technical solution is as follows:

[0098] Obtain the swipe event queue, which is constructed based on the various swipe events generated by the user's swipe operation. The swipe event includes the scroll amount generated by the swipe event along the screen swipe direction and the timestamp of the swipe event.

[0099] Based on each timestamp, obtain the first preset number of swipe events closest to the current time to obtain the first set, and obtain the second preset number of swipe events closest to the current time to obtain the second set; the first preset number is less than the second preset number.

[0100] Calculate the average of the absolute values ​​of the scroll amounts of all swipe events in the first set to obtain the first average; calculate the average of the absolute values ​​of the scroll amounts of all swipe events in the second set to obtain the second average.

[0101] Determine if the first average value is not greater than the second average value; if so, do not trigger the current swipe event.

[0102] The sliding event handling method provided in this embodiment of the invention calculates a first average value by averaging the absolute values ​​of the scroll amounts of all sliding events in a first set, and a second average value by averaging the absolute values ​​of the scroll amounts of all sliding events in a second set. The first set is a set of a first preset number of sliding events closest to the current time, and the second set is a set of a second preset number of sliding events closest to the current time. The first preset number is less than the second preset number. The method determines whether the first average value is not greater than the second average value; if so, the current sliding event is not triggered. In other words, the sliding event handling method provided in this embodiment of the invention does not rely on the absolute value of the scroll amount, but rather determines the user's intention to slide by analyzing the relative trend of the absolute value of the scroll amount. If the first average value is not greater than the second average value, it indicates that the relative trend of the absolute value of the scroll amount is upward, and the device will not trigger the current sliding event. This eliminates the influence of differences in the absolute values ​​of scroll amounts between different devices, thereby improving the accuracy of the sliding response and enhancing the user experience.

[0103] The following provides a detailed description of the sliding event handling method provided in the embodiments of the present invention.

[0104] See Figure 1 This is a schematic diagram of the first type of sliding event handling method provided in the embodiment of the present invention, which includes S101-S105.

[0105] S101: Get the sliding event queue.

[0106] S102: Based on each timestamp, obtain the first preset number of swipe events closest to the current time to obtain the first set, and obtain the second preset number of swipe events closest to the current time to obtain the second set.

[0107] S103: Calculate the average of the absolute values ​​of the scroll amounts of all sliding events in the first set to obtain the first average value; calculate the average of the absolute values ​​of the scroll amounts of all sliding events in the second set to obtain the second average value.

[0108] S104: Determine whether the first average value is not greater than the second average value.

[0109] If so, execute S105.

[0110] S105: Do not trigger the current swipe event.

[0111] A wheel event refers to the interactive event generated when a user performs a swipe operation on the touchpad or mouse. Each swipe operation by the user can generate at least one wheel event. The scroll amount is the pixel distance the page or element offsets after scrolling.

[0112] In other words, a swipe event can be generated when a user swipes the touchpad or when a user scrolls the mouse wheel. A swipe event includes the amount of scrolling along the screen's swipe direction and a timestamp. When the screen swipe direction is vertical, the amount of scrolling along that direction is deltaY; when the screen swipe direction is horizontal, the amount of scrolling along that direction is deltaX. This embodiment of the invention uses a vertical screen swipe direction, i.e., the amount of scrolling is deltaY, for explanation. However, for the case where the screen swipe direction is horizontal, the swipe event processing method provided in this embodiment can also be used.

[0113] deltaY represents the vertical scroll increment of the current swipe event, typically measured in pixels. In other words, deltaY indicates the number of pixels scrolled vertically during the current swipe event. The positive or negative value of deltaY indicates the scrolling direction. For example, a positive deltaY value indicates scrolling downwards (or swiping the touchpad downwards), while a negative deltaY value indicates scrolling upwards (or swiping the touchpad upwards). A larger absolute value of deltaY indicates a greater vertical scrolling distance. The range of deltaY values ​​varies significantly across different devices. For instance, the deltaY value for swipe events generated by a MacBook touchpad is typically between 100 and 500 pixels (absolute value), while for a Windows touchpad it is typically between 10 and 50 pixels (absolute value), and for a mouse wheel it is typically between 100 and 120 pixels (absolute value).

[0114] Specifically, all swipe events generated by the electronic device can be monitored and collected continuously, including the scroll amount deltaY and timestamp information of each swipe event, to obtain a swipe event queue. In this embodiment of the invention, the swipe event data is collected using full sampling, meaning no raw sensor data is discarded. All raw data points detected by the touchpad are completely converted into swipe event data and reported to the operating system or application without filtering or intervals. This ensures that events are not discarded due to sampling frequency issues during the data acquisition phase, guaranteeing the integrity and accuracy of the swipe event data. The collected swipe events can be stored in a swipe event queue (eventQueue), maintaining data from the most recent N swipe events. For clarity, the solution layout will be described in detail below.

[0115] The timestamp records the time information of the swipe event. Based on each timestamp, a first set of swipe events closest to the current time (a first preset number) is selected, and a second set of swipe events closest to the current time (a second preset number) is selected. The average absolute value of the scroll amount of all swipe events in the first set is calculated to obtain the first average value; the average absolute value of the scroll amount of all swipe events in the second set is calculated to obtain the second average value. Because the second set contains the second preset number of swipe events closest to the current time, and the first set contains the first preset number of swipe events closest to the current time, the first preset number is less than the second preset number, indicating that swipe events from the first set exist in the second set. If the first average value is greater than the second average value, it means that the average absolute value of the scroll amount of swipe events outside the first set in the second set is less than the average absolute value of the scroll amount of all swipe events in the first set. In other words, as time changes, the scroll amount of the swipe event increases, indicating that the user has a swipe intention and the current swipe event can be triggered.

[0116] If the first average is less than the second average, it means that the average absolute value of the scroll amount of the swipe events in the second set (excluding the first set) is greater than the average absolute value of the scroll amount of all swipe events in the first set. In other words, the scroll amount of the swipe events decreases over time, indicating that the user's intention to swipe is weakening and there is no need to trigger the current swipe time.

[0117] The first and second preset quantities can be set according to the actual application situation. As long as the first preset quantity is less than the second preset quantity, when the first average value is not greater than the second average value, it means that the scroll volume is not on an upward trend. This indicates that the user has no intention to swipe or is ending the swipe operation, so the swipe operation will not be triggered, that is, the swipe event will be blocked and the operation will not be responded to.

[0118] In one example, if the number of swipe events acquired is no less than 40, then the first preset number is set to 20 and the second preset number is set to 40. Therefore, the first average value is the average of the absolute values ​​of the scroll amounts of the 20 most recent swipe events, denoted as tail20AverageDelta; the second average value is the average of the absolute values ​​of the scroll amounts of the 40 most recent swipe events, denoted as tail40AverageDelta. When tail20AverageDelta < tail40AverageDelta, it means that the average of the absolute values ​​of the scroll amounts of the most recent 20 swipe events is less than the average of the absolute values ​​of the scroll amounts of the most recent 40 swipe events, indicating that the scroll amount has been decreasing recently. When tail20AverageDelta = tail40AverageDelta, or when they are approximately equal (a certain error is acceptable), it means that the scroll amount remains relatively stable. Therefore, in both of these cases, no swipe operation will be triggered. Furthermore, if the number of obtained sliding events is no less than 20 and less than 40 (e.g., 30), the first preset number is set to 20, and the second preset number is the number of obtained sliding events (e.g., 30). If the number of obtained sliding events is less than 20, the data volume is insufficient to make an effective trend judgment, and the sliding operation is not triggered.

[0119] The first average value is obtained by calculating the average of the absolute values ​​of the scroll amounts of all swipe events in the first set, and the second average value is obtained by calculating the average of the absolute values ​​of the scroll amounts of all swipe events in the second set. The first set is the set of a first preset number of swipe events closest to the current time, and the second set is the set of a second preset number of swipe events closest to the current time. The first preset number is less than the second preset number. The system then determines whether the first average value is not greater than the second average value; if so, no swipe operation is triggered. In other words, the swipe event processing method provided in this embodiment does not rely on the absolute value of the scroll amount, but rather determines the user's swipe operation intention by analyzing the relative change trend of the absolute value of the scroll amount. If the first average value is not greater than the second average value, it indicates that the relative change trend of the absolute value of the scroll amount is not upward, and the device will not trigger a swipe operation, reducing unnecessary swipe events. By comparing the average values ​​of different event quantity windows to identify the trend direction, this trend-based judgment method can accurately identify user intentions on different devices, eliminating the influence of differences in the absolute values ​​of scroll amounts between different devices, thereby improving the accuracy of swipe response and enhancing the user experience.

[0120] In one possible implementation, if the first average value is greater than the second average value, see [link to relevant documentation]. Figure 2 This is another flowchart illustrating the sliding event handling method provided in this embodiment of the invention. Figure 1 Compared to the illustrated embodiment, the following steps S106-S107 are also included.

[0121] S106: Determine the sliding rise amplitude based on the first average value and the second average value.

[0122] S107: Determine whether the sliding rise amplitude is not greater than the preset amplitude threshold.

[0123] If so, execute S105.

[0124] The sliding increase magnitude represents the increase of the first average value relative to the second average value. If the first average value is greater than the second average value, it indicates that the relative trend of the absolute value of the rolling amount is upward. In this case, the sliding increase magnitude is determined based on the first and second average values. Specifically, the difference between the first and second average values ​​is calculated, and then the ratio of the difference to the second average value is calculated to obtain the sliding increase magnitude. For example, if the first average value is tail20AverageDelta and the second average value is tail40AverageDelta, then the sliding increase magnitude is: (tail20AverageDelta - tail40AverageDelta) / tail40AverageDelta.

[0125] The swipe action is only triggered when the scrolling increase exceeds a preset threshold, indicating sufficient growth and a clear user intent to swipe. Otherwise, even if the scrolling volume is increasing, no swipe action will be triggered. The preset threshold can be dynamically calculated to automatically adapt to the characteristics of different devices, and will be explained in detail below for clarity.

[0126] The sliding process can be divided into the following states in the embodiments of the present invention:

[0127] 1. Rising Stage:

[0128] Definition: The first average value is greater than the second average value (e.g., tail20AverageDelta > tail40AverageDelta, meaning the average absolute value of the scroll volume of the last 20 events is greater than the average value of the last 40 events).

[0129] Feature: The absolute value of the scrolling amount is increasing, indicating that the intensity of the user's scrolling operation is increasing.

[0130] Processing: When the device is in an upward state and the upward movement reaches a dynamic threshold, it is assumed that the user has a clear intention to swipe, and a swipe operation is triggered.

[0131] 2. Falling Stage:

[0132] Definition: The first average value is less than the second average value (e.g., tail20AverageDelta < tail40AverageDelta, that is, the average absolute value of the rolling amount of the last 20 events is less than the average value of the last 40 events).

[0133] Characteristic: The absolute value of the rolling amount is decreasing, indicating that the intensity of the user's sliding operation is weakening, and the sliding operation may be ending.

[0134] Processing: Start the blocking logic to prevent the system from receiving redundant events and restrict unnecessary sliding events.

[0135] 3. Stable State:

[0136] Definition: The first average value is equal to the second average value (e.g., tail20AverageDelta = tail40AverageDelta, that is, the average absolute value of the rolling amount of the last 20 events is equal to or close to the average value of the last 40 events).

[0137] Characteristic: The rolling amount remains relatively stable. It may be that the user keeps sliding with unchanged intensity, or it is a transition stage of the sliding operation.

[0138] Processing: Do not trigger the sliding operation and wait for the state to change.

[0139] By judging whether the sliding rising amplitude meets the dynamic rising amplitude threshold, filter out the sliding events with slow increase, and only respond to the sliding events with an obvious upward trend, avoiding mis-triggering the sliding events due to minor fluctuations, which can more accurately identify the user's true sliding intention and improve the accuracy of sliding response.

[0140] In a possible implementation manner, when it is determined based on the above step S107 that the sliding rising amplitude is greater than the preset amplitude threshold, refer to Figure 3 , which is another flowchart of the sliding event processing method provided by the embodiment of the present invention. The method further includes:

[0141] S1081: Judge whether there is a sliding event triggered by a responded sliding operation.

[0142] If yes, execute S1082; if no, execute S1084.

[0143] S1082: Calculate the difference between the first timestamp and the second timestamp to obtain the first time difference.

[0144] The first timestamp is the timestamp of the swipe event closest to the current moment, and the second timestamp is the timestamp of the swipe event that has triggered the swipe operation closest to the current moment.

[0145] S1083: Determine whether the first time difference is less than the preset time difference;

[0146] If not, proceed to S1084; if yes, proceed to S105.

[0147] S1084: Trigger the current swipe event.

[0148] If the upward movement of the slide exceeds a preset threshold, and no slide event has already triggered a slide operation, the slide operation is triggered directly. If a slide event has already triggered a slide operation, it is necessary to further determine whether the first time difference between the most recent slide event and the most recent slide event that has already triggered a slide operation is not less than a preset time difference. The slide operation will only be triggered if the first time difference is greater than or equal to the preset time difference; otherwise, the slide operation will not be triggered. In other words, if the first time difference is less than the preset time difference, the slide event will be blocked, and the slide operation will not be triggered regardless of whether it meets the upward trend condition and the preset threshold condition.

[0149] In other words, the following conditions must be met simultaneously to trigger the sliding operation in this embodiment of the invention:

[0150] 1. Condition for an upward trend: The first average is greater than the second average (e.g., tail20AverageDelta > tail40AverageDelta).

[0151] 2. Rise Amplitude Threshold Condition: The sliding rise amplitude is greater than the preset amplitude threshold;

[0152] 3. Throttling time condition: The first time difference is not less than the preset time difference.

[0153] The preset time difference can be dynamically calculated and automatically adapted to the characteristics of different devices. Its duration can be automatically adjusted according to the device's event frequency, typically covering most of the swipe events generated by a complete user swipe operation. Therefore, it can be triggered only once before the user completes the swipe operation. For clarity, the method for determining the preset time difference will be explained in detail below.

[0154] Based on the analysis of scroll volume trends and the upward amplitude of the swipe, combined with a preset time difference control mechanism, it is ensured that the response to touch swipe is triggered only once at the point of the upward trend. This means that it will not be triggered again before the user completes the swipe operation, thus ensuring that each swipe operation is responded to only once, further improving the accuracy of the swipe response.

[0155] In one possible implementation, the method for determining the preset time difference includes the following steps 1-6.

[0156] Step 1: Set a preset first sliding event interval, which represents the time difference between the trigger times of two preset sliding events.

[0157] Step 2: Based on each timestamp, obtain the third preset number of swipe events that are closest to the current time, and get the third set.

[0158] Step 3: Calculate the average sliding event interval based on the sliding event closest to the current time, the sliding event furthest from the current time, and the third preset quantity in the third set. The average sliding event interval characterizes the frequency of sliding event triggering on the target device.

[0159] Step 4: Determine the frequency type of the target device for the triggering frequency of sliding events based on the average sliding event interval.

[0160] Step 5: Set the first adjustment factor according to the frequency type.

[0161] Step 6: Calculate the product of the first sliding event interval and the first adjustment coefficient to obtain the preset time difference.

[0162] The target device is the device that responds to the sliding operation.

[0163] The preset first sliding event interval can be used as the benchmark value for calculating the preset time difference (dynamic throttling time). Based on the sliding event closest to the current time, the sliding event furthest from the current time in the third set, and the third preset quantity, the average sliding event interval is calculated. The average sliding event interval reflects the sliding event triggering frequency of the target device and can be used to determine the frequency type of the target device (high-frequency device, medium-frequency device, low-frequency device). Specifically, the time difference between the closest and furthest sliding events in the third set can be calculated to obtain the second time difference; the difference between the third preset quantity and 1 can be calculated to obtain the first quantity difference; and the ratio of the second time difference to the first quantity difference can be calculated to obtain the average sliding event interval.

[0164] The preset time difference can be obtained by determining the first adjustment coefficient based on the frequency type, and then calculating the product of the first sliding event interval and the first adjustment coefficient. For example, the higher the frequency type, the smaller the determined first adjustment coefficient.

[0165] In one example, the first sliding event interval can be set to 200ms. If the third preset quantity is 20, the timestamp of the sliding event closest to the current time in the third set is 20ms, and the timestamp of the sliding event farthest from the current time in the third set is 160ms, then the average sliding event interval is: (160-20) / (20-1) = 7.37ms.

[0166] Determining the device frequency type and the first adjustment factor based on the average sliding event interval can be achieved in the following way (the first sliding event interval is 200ms):

[0167] If the average swipe event interval is less than 10ms, the device is determined to be a high-frequency device (such as a MacBook trackpad). In this case, setting the first adjustment factor to 0.75 will result in a preset time difference of approximately 200 × 0.75 = 175ms. Because high-frequency devices trigger events frequently, a shorter throttling time can cover most of the swipe events generated by a single complete swipe operation by the user, while maintaining responsiveness.

[0168] If 10ms ≤ average sliding event interval < 30ms, the device frequency type is determined to be a medium frequency device. In this case, the first adjustment coefficient is set to 1.0, and the preset time difference is approximately 200×1=200ms.

[0169] If the average swipe event interval is not less than 30ms, the device frequency type is determined to be a low-frequency device (such as some Windows touchpads). In this case, setting the first adjustment factor to 1.5 will result in a preset time difference of approximately 200 × 1.5 = 300ms. Because low-frequency devices have a longer event trigger interval, a longer throttling time is required to cover most of the events generated by a complete swipe operation by the user.

[0170] It should be noted that if the number of third presets is less than 10, the amount of data is insufficient, and the average sliding event interval cannot be calculated. In this case, the default value of 20ms will be returned.

[0171] In practical implementation, a dynamic time window blocking mechanism (dynamic throttling time window) can be used to ensure that only one sliding event is triggered in a single sliding operation. Within the dynamic throttling time window (first timestamp - second timestamp < first time difference), all subsequent sliding events will be blocked, regardless of whether these events meet the upward trend condition and amplitude threshold condition. This means that even if subsequent sliding events still meet the upward trend and dynamic upward amplitude threshold, they will be ignored and will not trigger the sliding operation because they are still within the dynamic throttling time window.

[0172] Once the first time difference is not less than the preset time difference, the throttling mechanism is lifted. At this point, if a new sliding event meets the conditions of an upward trend and a preset amplitude threshold, the sliding event can be triggered again.

[0173] When an upward trend is detected and the increase in interaction reaches a preset threshold, a sliding event is triggered and the trigger time is recorded. A dynamic throttling time window is set. Within the dynamic throttling time window (dynamically adjusted according to the device frequency, 100-150ms for high-frequency devices and 200-300ms for low-frequency devices), all subsequent sliding events will be blocked, even if they still meet the conditions of an upward trend and the preset threshold.

[0174] The following is an example:

[0175] Assuming a user performs a swipe action, generating 10 swipe events (event 1 to event 10), with an average swipe event interval of 20ms (medium-frequency device):

[0176] Event 1 (t=0ms): The upward trend is satisfied, but the sliding increase is less than the preset threshold. In this case, the sliding operation is not triggered.

[0177] Event 2 (t=20ms): The upward trend is met, the sliding increase is greater than the preset threshold, and it is not within the dynamic throttling time. At this time, the sliding operation is triggered and the trigger time t=20ms is recorded. The dynamic throttling window is set to [20ms, 220ms].

[0178] Event 3 (t=40ms): The upward trend is met, and the sliding increase is greater than the preset threshold, but during the dynamic throttling time (40ms < 220ms), the operation is blocked and the sliding operation is not triggered.

[0179] Event 4 (t=60ms): The upward trend is met, and the sliding increase is greater than the preset threshold, but during the dynamic throttling time (60ms < 220ms), the operation is blocked and the sliding operation is not triggered.

[0180] ...

[0181] Event 10 (t=180ms): The upward trend is met, and the sliding increase is greater than the preset threshold. However, during the dynamic throttling time (180ms < 220ms), the operation is blocked and the sliding operation is not triggered.

[0182] Result: Although events 3 through 10 all met the upward trend and preset amplitude threshold conditions, only event 2 triggered the sliding operation due to the protection of the dynamic throttling mechanism, ensuring that it was triggered only once. The dynamic throttling time is automatically adjusted according to the device event frequency to effectively prevent multiple triggers on different devices.

[0183] In one possible implementation, the preset amplitude threshold is determined by the following steps A-F.

[0184] Step A: Set the preset first amplitude threshold.

[0185] Step B: Based on each timestamp, obtain the fourth preset number of sliding events that are closest to the current time, and obtain the fourth set.

[0186] Step C: Calculate the average of the absolute values ​​of the scroll amounts of all sliding events in the fourth set to obtain the third average. The third average characterizes the magnitude of the scroll amount change of the sliding events on the target device.

[0187] Step D: Determine the type of rolling volume for the target device in response to the magnitude of rolling volume variation based on the third average value.

[0188] Step E: Set the second adjustment factor according to the scrolling amount type.

[0189] Step F: Calculate the product of the first amplitude threshold and the second adjustment coefficient to obtain the preset amplitude threshold.

[0190] The preset first amplitude threshold can be used as the benchmark value for calculating the preset amplitude threshold. By calculating the average of the absolute values ​​of the scroll amounts of all swipe events in the fourth set, the third average value is obtained. The third average value can reflect the typical scroll amount of the device and can be used to determine the scroll amount type of the device (large deltaY devices such as MacBooks, small deltaY devices such as Windows touchpads).

[0191] Based on the third average value, the type of rolling volume for the target device in response to the change in rolling volume is determined. A second adjustment coefficient is then set according to the rolling volume type, with a smaller second adjustment coefficient corresponding to a larger rolling volume. Finally, the product of the first amplitude threshold and the second adjustment coefficient is calculated to obtain the preset amplitude threshold.

[0192] In one example, the first amplitude threshold can be set to 5%, and the device scrolling type and second adjustment coefficient can be determined based on the third average value in the following way:

[0193] If the third average value is greater than 100 pixels, the device is determined to be a large deltaY device (such as a MacBook trackpad, typically ranging from 100 to 500 pixels). In this case, setting the second adjustment factor to 0.7 results in a preset amplitude threshold of approximately 5% × 0.7 = 3.5%. Because large deltaY devices exhibit significant fluctuations in scroll volume, using a smaller threshold allows for a more sensitive response to the user's swiping intentions.

[0194] If 50 pixels < the third average value ≤ 100 pixels, the device scrolling type is determined to be a medium deltaY device. In this case, the second adjustment factor is set to 0.9, and the preset amplitude threshold is approximately 5% × 0.9 = 4.5%.

[0195] If the third average value is not greater than 50 pixels, the device scrolling type is determined to be a small deltaY device (such as a Windows touchpad, typically ranging from 10 to 50 pixels). In this case, setting the second adjustment factor to 1.3 will result in a preset amplitude threshold of approximately 5% × 1.3 = 6.5%. Since the scrolling amplitude of small deltaY devices is relatively small, using a larger threshold can filter out minor fluctuations, thereby avoiding false triggers.

[0196] It should be noted that the fourth preset quantity can be equal to or different from the third preset quantity. If the fourth preset quantity is less than 10, the data volume is insufficient to accurately calculate the device scrolling volume feature, and the default value of 100 pixels will be returned.

[0197] As can be seen from the above, the preset amplitude threshold and preset time difference (dynamic throttling time) of the embodiments of the present invention can be dynamically calculated based on the collected sliding event data, which can automatically identify the device characteristics and adjust the parameters, and can adapt to different types of devices without manual configuration.

[0198] In one possible implementation, the method further includes:

[0199] Based on each timestamp, each sliding event is stored in the sliding event queue in chronological order.

[0200] The maximum capacity of the sliding event queue can be set based on the number of sliding events generated by a single sliding operation. It can usually be set slightly larger to provide buffering (e.g., 50 events). If the actual number of sliding events stored exceeds the maximum capacity, the sliding event furthest from the current time is removed from the queue (keeping the queue containing only the sliding event closest to the current time). This ensures that the queue always contains the latest sliding event data while controlling memory usage.

[0201] In one example, to calculate the average of the most recent 20 and 40 slide events, the queue needs to hold data for at least 40 events. In practical applications, the size of the slide event queue can be adjusted as needed.

[0202] After collecting the sliding event data, it is stored in the sliding event queue in chronological order according to the timestamp. When performing calculations or analysis later, it can be directly selected from the sliding event queue, which is convenient for management and use and can improve processing efficiency.

[0203] In one possible implementation, if the queue length of the sliding event queue is a multiple of 10, or the queue length is less than 10, the preset amplitude threshold and preset time difference are updated. The parameters can be adjusted periodically according to the latest device characteristics, while avoiding overly frequent calculations.

[0204] In one possible implementation, based on each timestamp, each sliding event is stored in a sliding event queue in chronological order, including:

[0205] Get all the swipe events generated by the user's swipe actions;

[0206] For each swipe event, determine whether the scroll amount and timestamp of the swipe event are in the preset data format.

[0207] If so, the data format of the sliding event is determined to be incorrect, and the sliding event is not stored in the sliding event queue. For example, check whether the deltaY and timestamp of the sliding event are null (no value), undefined (unassigned), or NaN (not a number). Here, null, undefined, and NaN are the default data formats. If they are, it is determined that the format is incorrect, the data is invalid, and the sliding event is not stored in the sliding event queue.

[0208] If the scroll amount and timestamp of the sliding event are not in the preset data format, then determine whether the timestamp of the sliding event is less than the timestamp of the previous stored sliding event (timestamps in reverse order).

[0209] If yes, then the sliding event will not be stored in the sliding event queue; otherwise, it will be determined whether the interval between the timestamp of the sliding event and the timestamp of the previous sliding event is greater than a preset time interval (e.g., 500ms).

[0210] If yes, it is determined that the time interval is too long and the sliding event is not stored in the sliding event queue; if no, it is determined whether the absolute value of the scroll amount of the sliding event is less than the preset scroll amount threshold (such as 5 pixels).

[0211] If yes, it is determined to be noise data, which may be due to slight user touch or device sampling fluctuations, and the swipe event will not be stored in the swipe event queue; otherwise, the swipe event will be stored in the swipe event queue, thus obtaining the swipe event queue.

[0212] Before constructing the sliding event queue, data verification is performed on each sliding event to remove noise, outliers, and invalid data, ensuring that all sliding event data stored in the sliding event queue is valid, thereby improving the accuracy and efficiency of sliding event processing.

[0213] In one possible implementation, after obtaining the sliding event queue, the method further includes:

[0214] Calculate the average of the absolute values ​​of the scroll amounts of the five most recent (e.g., the last 10) sliding events in the sliding event queue that are most recent to the current time, and obtain the fourth average value.

[0215] For each sliding event in the sliding event queue, determine whether the absolute value of the scroll amount of the sliding event is greater than a first preset multiple of the fourth average value, or whether the absolute value of the scroll amount of the sliding event is less than a preset proportion of the fourth average value, wherein the preset multiple is greater than 1 and the preset proportion is less than 1; if so, remove the sliding event from the sliding event queue.

[0216] If not, if the first absolute value is not 0, determine whether the first scroll amount difference is greater than a second preset multiple of the first absolute value, where the second preset multiple is greater than 1; if so, remove the scroll event from the scroll event queue; where the first scroll amount difference is the difference between the absolute value of the scroll amount of the scroll event and the scroll amount of the previous scroll event, and the first absolute value is the absolute value of the scroll amount of the scroll event furthest from the current time in the scroll event queue;

[0217] If not, then retain the slide event in the slide event queue.

[0218] It should be noted that if the number of sliding events in the sliding event queue is less than 5, the amount of data is insufficient to perform outlier detection, and outlier detection in this embodiment will not be performed temporarily, and the data will continue to be processed.

[0219] After obtaining the sliding event queue, outlier detection in this embodiment can ensure that the queue contains only valid and normal data, avoiding outliers from affecting subsequent trend analysis and trigger judgment, thereby improving the accuracy of sliding data processing.

[0220] In one possible implementation, the sliding event handling method provided by the embodiments of the present invention includes the following process:

[0221] Start execution.

[0222] 1. Listen for and collect sliding events.

[0223] 2. Data preprocessing: Verify the validity of data by checking for format errors (null, undefined, NaN), timestamp anomalies (such as reversed time or excessively large time intervals), noise (such as excessively small absolute value of deltaY), and outliers (such as extreme values ​​or data mutations). If the data is invalid, it is discarded and not stored in the sliding event queue. If the data is valid, processing continues.

[0224] 3. Enqueue the sliding event data. Each sliding event includes the scroll amount deltaY and a timestamp. If the queue is full, remove the oldest event to obtain the sliding event queue.

[0225] 4. Calculate the equipment characteristics, including equipment frequency type and equipment scrolling type; dynamically update the preset amplitude threshold and preset time difference based on the equipment characteristics, wherein the preset amplitude threshold is adjusted according to the range of the absolute value of average deltaY, and the preset time difference is adjusted according to the average sliding event interval.

[0226] 5. Use the absolute value of deltaY to calculate the scrolling trend; for example, calculate the average of the last 20 swipe events (tail20AverageDelta) and the average of the last 40 swipe events (tail40AverageDelta).

[0227] 6. Calculate the sliding rise amplitude (tail20AverageDelta-tail40AverageDelta) / tail40AverageDelta).

[0228] 7. Determine the sliding state:

[0229] Rising trend: tail20AverageDelta > tail40AverageDelta;

[0230] Decreasing state: tail20AverageDelta < tail40AverageDelta;

[0231] In a steady state, tail20AverageDelta is approximately equal to tail40AverageDelta.

[0232] 8. Determine if it is in an upward trend?

[0233] If not (i.e., in a declining or stable state), block the current swipe event and do not respond to the swipe operation; if yes, continue execution.

[0234] 9. Determine if the sliding upward amplitude has reached the preset amplitude threshold?

[0235] If not, it indicates that the upward movement is insufficient, so the current sliding event is blocked and the sliding operation is not responded to; if yes, continue execution.

[0236] 10. Determine if the difference between the timestamp of the current swipe event and the timestamp of the swipe event triggered by the nearest swipe operation is less than a preset time difference. If yes, block the current swipe event and do not respond to the swipe operation; if no, trigger the current swipe event, record the trigger time, and set a dynamic throttling time window based on the difference between the trigger time of the current swipe event and the preset time.

[0237] Execution terminated.

[0238] This invention collects and preprocesses swipe events to construct a swipe event queue. Device characteristics are calculated based on the data in the queue, and preset amplitude thresholds and preset time differences are dynamically updated according to these characteristics. Processing swipe events based on these preset amplitude thresholds and time differences enhances the consistency of swipe responses across different devices, improves the accuracy of swipe intent judgment, and avoids false triggers. This not only improves the accuracy of swipe responses but also reduces response latency by preventing excessive swipes, thereby improving device response speed and interaction precision. Furthermore, by setting a dynamic throttling time window, when the timestamp of a swipe event falls within the throttling time window, the current swipe event is blocked, and no swipe operation is responded to. This ensures that the response to a swipe operation is triggered only once when the amplitude is increasing and reaches the preset amplitude threshold, improving the smoothness of swipes and the user experience.

[0239] Corresponding to the aforementioned sliding event handling method, this invention also provides a sliding event handling device, see [link to device]. Figure 4 The device includes:

[0240] The first acquisition module 201 is used to acquire a sliding event queue, wherein the sliding event queue is constructed based on various sliding events generated by the user's sliding operation, and the sliding event includes the scrolling amount generated by the sliding event along the screen sliding direction and the timestamp of the sliding event.

[0241] The second acquisition module 202 is used to acquire, based on each timestamp, a first preset number of sliding events closest to the current time to obtain a first set, and to acquire a second preset number of sliding events closest to the current time to obtain a second set; the first preset number is less than the second preset number.

[0242] The first calculation module 203 is used to calculate the average of the absolute values ​​of the scroll amounts of all sliding events in the first set to obtain a first average value; and to calculate the average of the absolute values ​​of the scroll amounts of all sliding events in the second set to obtain a second average value.

[0243] The first processing module 204 is used to determine whether the first average value is not greater than the second average value; if so, the current sliding event is not triggered.

[0244] In one possible implementation, the device further includes:

[0245] The second processing module is used to determine the sliding increase amplitude based on the first average value and the second average value if the first average value is greater than the second average value. The sliding increase amplitude represents the increase of the first average value relative to the second average value.

[0246] The third processing module is used to prevent the current sliding event from being triggered if the sliding increase is not greater than a preset threshold.

[0247] In one possible implementation, the device further includes:

[0248] The fourth processing module is used to determine whether there is a sliding event that has been triggered in response to the sliding operation when the sliding increase is greater than a preset threshold. If there is no such event, the current sliding event is triggered.

[0249] The fifth processing module is used to calculate the difference between the first timestamp and the second timestamp, if they exist, to obtain the first time difference; wherein the first timestamp is the timestamp of the current sliding event, and the second timestamp is the timestamp of the sliding event triggered by the most recent sliding operation that has been responded to at the current time.

[0250] The sixth processing module is used to determine whether the first time difference is less than the preset time difference. If it is, the current sliding event is not triggered; otherwise, the current sliding event is triggered.

[0251] In one possible implementation, the device further includes:

[0252] The module for determining the preset time difference is used to determine the preset time difference; it includes:

[0253] The first setting submodule is used to set a preset first sliding event interval, which represents the time difference between the trigger times of two preset sliding events;

[0254] The first acquisition submodule is used to acquire the third preset number of sliding events closest to the current time based on each timestamp, and obtain the third set;

[0255] The first calculation submodule is used to calculate the average sliding event interval based on the sliding event closest to the current time, the sliding event farthest from the current time, and the third preset quantity in the third set. The average sliding event interval represents the sliding event triggering frequency of the target device, which is the device that responds to the sliding operation.

[0256] The first determining submodule is used to determine the frequency type of the target device for the sliding event triggering frequency based on the average sliding event interval;

[0257] The second setting submodule is used to set the first adjustment coefficient according to the frequency type;

[0258] The second calculation submodule is used to calculate the product of the first sliding event interval and the first adjustment coefficient to obtain the preset time difference.

[0259] In one possible implementation, the device further includes: a preset time difference determination module, used to determine a preset amplitude threshold, including:

[0260] The third setting submodule is used to set the preset first amplitude threshold;

[0261] The second acquisition submodule is used to acquire the fourth preset number of sliding events closest to the current time based on each timestamp, and obtain the fourth set;

[0262] The third calculation submodule is used to calculate the average of the absolute values ​​of the scrolling amount of all sliding events in the fourth set, and obtain the third average value, which represents the magnitude of the change in the scrolling amount of the sliding events of the target device.

[0263] The second determining submodule is used to determine the type of rolling amount of the target device in response to the rolling amount change based on the third average value;

[0264] The fourth setting submodule is used to set the second adjustment coefficient according to the scroll amount type;

[0265] The fourth calculation submodule is used to calculate the product of the first amplitude threshold and the second adjustment coefficient to obtain the preset amplitude threshold.

[0266] In one possible implementation, the first acquisition module is specifically used for:

[0267] Get all swipe events generated by the user's swipe actions;

[0268] For each swipe event, determine whether the scroll amount and timestamp of the swipe event are in the preset data format; if so, determine that the data format of the swipe event is incorrect and do not store the swipe event in the swipe event queue.

[0269] If not, then determine whether the timestamp of the current sliding event is less than the timestamp of the previous stored sliding event; if so, then do not store the current sliding event in the sliding event queue.

[0270] If not, determine whether the interval between the timestamp of the current sliding event and the timestamp of the previous sliding event is greater than a preset time interval; if so, do not store the sliding event in the sliding event queue.

[0271] If not, determine whether the absolute value of the scroll amount of the swipe event is less than the preset scroll amount threshold; if so, do not store the swipe event in the swipe event queue.

[0272] If not, the sliding event is stored in the sliding event queue, thus obtaining the sliding event queue.

[0273] In one possible implementation, the apparatus further includes a building module for:

[0274] After obtaining the sliding event queue, calculate the average of the absolute values ​​of the scroll amounts of the fifth preset number of sliding events in the sliding event queue that are closest to the current time, and obtain the fourth average value;

[0275] For each sliding event in the sliding event queue, determine whether the absolute value of the scroll amount of the sliding event is greater than a first preset multiple of the fourth average value, or whether the absolute value of the scroll amount of the sliding event is less than a preset proportion of the fourth average value, wherein the preset multiple is greater than 1 and the preset proportion is less than 1; if so, remove the sliding event from the sliding event queue.

[0276] If not, if the first absolute value is not 0, determine whether the first scroll amount difference is greater than a second preset multiple of the first absolute value, where the second preset multiple is greater than 1; if so, remove the scroll event from the scroll event queue; where the first scroll amount difference is the difference between the absolute value of the scroll amount of the scroll event and the scroll amount of the previous scroll event, and the first absolute value is the absolute value of the scroll amount of the scroll event furthest from the current time in the scroll event queue;

[0277] If not, then retain the slide event in the slide event queue.

[0278] This invention also provides an electronic device, such as... Figure 5 As shown, it includes a processor 301, a communication interface 302, a memory 303, and a communication bus 304, wherein the processor 301, the communication interface 302, and the memory 303 communicate with each other through the communication bus 304.

[0279] Memory 303 is used to store computer programs;

[0280] When processor 301 executes a program stored in memory 303, it performs the following steps:

[0281] Obtain the swipe event queue, which is constructed based on the various swipe events generated by the user's swipe operation. The swipe event includes the scroll amount generated by the swipe event along the screen swipe direction and the timestamp of the swipe event.

[0282] Based on each timestamp, obtain the first preset number of swipe events closest to the current time to obtain the first set, and obtain the second preset number of swipe events closest to the current time to obtain the second set; the first preset number is less than the second preset number.

[0283] Calculate the average of the absolute values ​​of the scroll amounts of all swipe events in the first set to obtain the first average; calculate the average of the absolute values ​​of the scroll amounts of all swipe events in the second set to obtain the second average.

[0284] Determine if the first average value is not greater than the second average value; if so, do not trigger the current swipe event.

[0285] The communication bus mentioned above can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used to represent it in the diagram, but this does not mean that there is only one bus or one type of bus.

[0286] The communication interface is used for communication between the aforementioned terminal and other devices.

[0287] The memory may include random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.

[0288] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.

[0289] In another embodiment of the present invention, a computer-readable storage medium is also provided, wherein a computer program is stored therein, and when the computer program is executed by a processor, it implements any of the sliding event handling methods described in the above embodiments.

[0290] In another embodiment of the present invention, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to execute any of the sliding event handling methods described in the above embodiments.

[0291] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present invention are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium accessible to a computer or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state disk (SSD)).

[0292] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0293] The various embodiments in this specification are described in a related manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the embodiments of apparatus, electronic devices, storage media, and computer program products are basically similar to the method embodiments, so the descriptions are relatively simple; relevant parts can be referred to the descriptions of the method embodiments.

[0294] The above description is merely a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention are included within the scope of protection of the present invention.

Claims

1. A sliding event handling method, characterized in that, The method includes: Obtain a swipe event queue, wherein the swipe event queue is constructed based on various swipe events generated by the user's swipe operation, and the swipe event includes the scroll amount generated by the swipe event along the screen swipe direction and the timestamp of the swipe event; Based on each timestamp, obtain a first preset number of swipe events closest to the current time to obtain a first set, and obtain a second preset number of swipe events closest to the current time to obtain a second set; the first preset number is less than the second preset number. Calculate the average of the absolute values ​​of the scroll amounts of all swipe events in the first set to obtain a first average; calculate the average of the absolute values ​​of the scroll amounts of all swipe events in the second set to obtain a second average. Determine whether the first average value is not greater than the second average value; if so, do not trigger the current sliding event.

2. The method according to claim 1, characterized in that, The method further includes: If the first average value is greater than the second average value, the sliding increase amplitude is determined based on the first average value and the second average value, wherein the sliding increase amplitude represents the increase of the first average value relative to the second average value; If the upward sliding amplitude is not greater than a preset amplitude threshold, the current sliding event will not be triggered.

3. The method according to claim 2, characterized in that, The method further includes: If the sliding increase is greater than a preset threshold, determine whether there is a sliding event that has been triggered in response to the sliding operation. If not, trigger the current sliding event. If it exists, calculate the difference between the first timestamp and the second timestamp to obtain the first time difference; wherein, the first timestamp is the timestamp of the current swipe event, and the second timestamp is the timestamp of the swipe event triggered by the swipe operation closest to the current time; Determine whether the first time difference is less than a preset time difference. If yes, do not trigger the current swipe event; otherwise, trigger the current swipe event.

4. The method according to claim 3, characterized in that, The method for determining the preset time difference includes: A preset first sliding event interval is set, which represents the time difference between the trigger times of two preset sliding events; Based on each of the timestamps, obtain the third preset number of sliding events closest to the current time to obtain the third set; Based on the sliding event closest to the current time, the sliding event farthest from the current time in the third set, and the third preset quantity, the average sliding event interval is calculated. The average sliding event interval represents the sliding event triggering frequency of the target device, and the target device is the device that responds to the sliding operation. The frequency type of the target device for triggering the sliding event frequency is determined based on the average sliding event interval; Set the first adjustment coefficient according to the frequency type; The preset time difference is obtained by multiplying the first sliding event interval by the first adjustment coefficient.

5. The method according to any one of claims 2-4, characterized in that, The method for determining the preset amplitude threshold includes: Set the preset first amplitude threshold; Based on each of the timestamps, obtain the fourth preset number of sliding events closest to the current time to obtain the fourth set; Calculate the average of the absolute values ​​of the scrolling amount of all sliding events in the fourth set to obtain a third average value, which characterizes the magnitude of the scrolling amount change of the sliding events of the target device; The type of rolling volume for the target device in response to the rolling volume change range is determined based on the third average value; Set a second adjustment factor according to the rolling amount type; The preset amplitude threshold is obtained by multiplying the first amplitude threshold by the second adjustment coefficient.

6. The method according to claim 1, characterized in that, The process of obtaining the sliding event queue includes: Get all swipe events generated by the user's swipe actions; For each swipe event, determine whether the scroll amount and timestamp of the swipe event are in the preset data format; if so, determine that the data format of the swipe event is incorrect and do not store the swipe event in the swipe event queue. If not, then determine whether the timestamp of the current sliding event is less than the timestamp of the previous stored sliding event; if so, then do not store the current sliding event in the sliding event queue. If not, determine whether the interval between the timestamp of the current sliding event and the timestamp of the previous sliding event is greater than a preset time interval; if so, do not store the sliding event in the sliding event queue. If not, determine whether the absolute value of the scroll amount of the swipe event is less than the preset scroll amount threshold; if so, do not store the swipe event in the swipe event queue. If not, the sliding event is stored in the sliding event queue, thus obtaining the sliding event queue.

7. The method according to claim 6, characterized in that, After obtaining the sliding event queue, the following is also included: Calculate the average of the absolute values ​​of the scroll amounts of the fifth preset number of sliding events in the sliding event queue that are closest to the current time, and obtain the fourth average value; For each sliding event in the sliding event queue, determine whether the absolute value of the scrolling amount of the sliding event is greater than a first preset multiple of the fourth average value, or whether the absolute value of the scrolling amount of the sliding event is less than a preset proportion of the fourth average value, wherein the preset multiple is greater than 1 and the preset proportion is less than 1; if so, remove the sliding event from the sliding event queue. If not, if the first absolute value is not 0, determine whether the first scroll amount difference is greater than a second preset multiple of the first absolute value, wherein the second preset multiple is greater than 1; if yes, remove the scroll event from the scroll event queue; wherein the first scroll amount difference is the difference between the absolute value of the scroll amount of the scroll event and the scroll amount of the previous scroll event, and the first absolute value is the absolute value of the scroll amount of the scroll event furthest from the current time in the scroll event queue; If not, the slide event is retained in the slide event queue.

8. A sliding event handling device, characterized in that, The device includes: The first acquisition module is used to acquire a sliding event queue, wherein the sliding event queue is constructed based on various sliding events generated by the user's sliding operation, and the sliding event includes the scroll amount generated by the sliding event along the screen sliding direction and the timestamp of the sliding event; The second acquisition module is used to acquire, based on each timestamp, a first preset number of swipe events closest to the current time to obtain a first set, and to acquire a second preset number of swipe events closest to the current time to obtain a second set; the first preset number is less than the second preset number. The first calculation module is used to calculate the average of the absolute values ​​of the scrolling amounts of all sliding events in the first set to obtain a first average value; and to calculate the average of the absolute values ​​of the scrolling amounts of all sliding events in the second set to obtain a second average value. The first processing module is used to determine whether the first average value is not greater than the second average value; if so, the current sliding event is not triggered.

9. An electronic device, characterized in that, It includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, when executing a program stored in memory, implements the steps of the method described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the method described in any one of claims 1-7.