Page scrolling control method and device
By receiving page operations and calculating the difference, controlling page scrolling, the problem of client page continuing to scroll after scrolling to the boundary is solved, improving user experience and avoiding lag, and using native scrolling logic to ensure that the page stops scrolling at boundary.
Patent Information
- Application Number
- CN202310745210.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-21
- Publication Date
- 2024-12-24
AI Technical Summary
When the client controls the page to scroll, the page is prone to scrolling to the content boundary and continues to scroll, resulting in poor user experience.
By receiving the page operation, calculate the operation position difference. If the difference is less than or equal to the preset threshold, obtain the initial operation position and sliding offset, and control the page to scroll at a constant speed; if the difference is greater than the threshold, use the native scroll control logic The constant speed scrolling logic can avoid page stuttering.
It effectively avoids the problem of the page continuing to scroll after scrolling to the content boundary, improves the user experience, ensures that the page stops scrolling when the content boundary, and avoids lag.
Smart Images

Figure CN119179422A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method and device for controlling page scrolling. Background Art
[0002] The user can scroll the page by triggering a corresponding operation. For example, the user can trigger a sliding operation on a touch screen to scroll the page. For another example, the user can operate a scroll bar on the page with a mouse to scroll the page.
[0003] Currently, when a client controls page scrolling, there is a problem that the page has been scrolled to the boundary of the page content, but the page continues to scroll, resulting in a poor user experience.
[0004] Therefore, a solution is urgently needed to solve the above problems. Summary of the invention
[0005] In order to solve or at least partially solve the above technical problems, an embodiment of the present application provides a method and device for controlling page scrolling.
[0006] In a first aspect, an embodiment of the present application provides a method for controlling page scrolling, the method comprising:
[0007] receiving an operation triggered on a page, the operation being used to trigger the page to scroll in a first direction, the page being used to display target content;
[0008] In response to a first difference between the first position and the second position being less than or equal to a preset threshold, obtaining an initial operation position and a sliding offset of the operation, and when the sliding offset is greater than the first difference, controlling the page to scroll the first difference at a uniform speed, the target content includes the first content, the first position is a position of the first content displayed in a target boundary area of the page in the target content, the second position is a boundary position corresponding to the target content in the second direction, the target boundary area is a boundary area of the page in the second direction, and the first direction is opposite to the second direction;
[0009] or,
[0010] In response to the first difference being greater than the preset threshold, the page is controlled to scroll at a uniform speed using a uniform scrolling control logic in a native scrolling control logic.
[0011] Optionally, the method further includes:
[0012] Obtaining a first scrolling distance and a first scrolling time of the page scrolling at a uniform speed;
[0013] In response to the operation being ended, determining a second scrolling distance of uniformly decelerated scrolling according to the first scrolling distance and the first scrolling time;
[0014] If a second difference between the third position and the second position is less than or equal to the second scrolling distance, the page is controlled to scroll the second difference at a uniform deceleration rate, the third position being the position of the second content displayed in the target boundary area in the target content, and the second content being the content displayed in the target boundary area when the uniform scrolling of the page ends.
[0015] Optionally, controlling the page to scroll the second difference at a uniform deceleration rate includes:
[0016] determining a second scrolling time according to the uniformly decelerated scrolling acceleration and the second difference;
[0017] The page is controlled to scroll at the uniformly decelerated speed for the second scrolling time.
[0018] Optionally, the method further includes:
[0019] In response to the first difference being less than or equal to the preset threshold, disabling native scroll control logic.
[0020] Optionally, the method further includes:
[0021] In response to the first difference being greater than the preset threshold, disabling the uniform deceleration scrolling control logic in the native scrolling control logic.
[0022] Optionally, the method further includes:
[0023] When the sliding offset is less than or equal to the first difference, the page is controlled to scroll the sliding offset at a uniform speed.
[0024] Optionally, the preset threshold is a difference between a boundary of the page in the first direction and a boundary of the page in the second direction.
[0025] In a second aspect, an embodiment of the present application provides a device for controlling page scrolling, the device comprising:
[0026] A receiving unit, configured to receive an operation triggered on a page, wherein the operation is used to trigger the page to scroll in a first direction, and the page is used to display target content;
[0027] A processing unit for:
[0028] In response to a first difference between the first position and the second position being less than or equal to a preset threshold, obtaining an initial operation position and a sliding offset of the operation, and when the sliding offset is greater than the first difference, controlling the page to scroll the first difference at a uniform speed, the target content includes the first content, the first position is a position of the first content displayed in a target boundary area of the page in the target content, the second position is a boundary position corresponding to the target content in the second direction, the target boundary area is a boundary area of the page in the second direction, and the first direction is opposite to the second direction;
[0029] or,
[0030] In response to the first difference being greater than the preset threshold, the page is controlled to scroll at a uniform speed using a uniform scrolling control logic in a native scrolling control logic.
[0031] Optionally, the device further comprises:
[0032] An acquisition unit, used for acquiring a first scrolling distance and a first scrolling time of the page being scrolled at a uniform speed;
[0033] A determining unit, configured to determine, in response to the operation being ended, a second scrolling distance of uniformly decelerated scrolling according to the first scrolling distance and the first scrolling time;
[0034] A first control unit is used to control the page to scroll the second difference at a uniform deceleration if a second difference between the third position and the second position is less than or equal to the second scrolling distance, the third position being a position of the second content displayed in the target boundary area in the target content, and the second content being the content displayed in the target boundary area when the uniform scrolling of the page ends.
[0035] Optionally, the first control unit is used to:
[0036] determining a second scrolling time according to the uniformly decelerated scrolling acceleration and the second difference;
[0037] The page is controlled to scroll at the uniformly decelerated speed for the second scrolling time.
[0038] Optionally, the device further comprises:
[0039] The first native disabling unit is configured to disable the native scroll control logic in response to the first difference being less than or equal to the preset threshold.
[0040] Optionally, the device further comprises:
[0041] The second native disabling unit is configured to disable the uniform deceleration scrolling control logic in the native scrolling control logic in response to the first difference being greater than the preset threshold.
[0042] Optionally, the device further comprises:
[0043] The second control unit is used to control the page to scroll the sliding offset at a uniform speed when the sliding offset is less than or equal to the first difference.
[0044] Optionally, the preset threshold is a difference between a boundary of the page in the first direction and a boundary of the page in the second direction.
[0045] In a third aspect, an embodiment of the present application provides a device, the device comprising a processor and a memory;
[0046] The processor is used to execute instructions stored in the memory so that the device executes the method described in any one of the first aspects above.
[0047] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, comprising instructions, wherein the instructions instruct a device to execute any of the methods described in the first aspect above.
[0048] In a fifth aspect, an embodiment of the present application provides a computer program product, which, when executed on a computer, enables the computer to execute any of the methods described in the first aspect above.
[0049] Compared with the prior art, the embodiments of the present application have the following advantages:
[0050] The embodiment of the present application provides a page scrolling control method, which can be applied to a client. In one example, a client can receive an operation triggered for a page, the operation is used to trigger the page to scroll in a first direction, and the page is used to display target content. In one example, when the user triggers the operation, the content displayed in the target boundary area of the page is the first content in the target content. Among them, the target boundary area is the boundary area of the page in the second direction, and the first direction and the second direction are opposite. After receiving the operation, it can be determined how to control the page scrolling according to the first difference between the first position and the second position of the first content in the target content. Among them, the second position is the boundary position corresponding to the target content in the second direction. Specifically, if the first difference is greater than a preset threshold, considering that the difference between the first position and the second position is large, the possibility of the content displayed on the page scrolling to the boundary of the target content in the first direction is small, therefore, the uniform scrolling control logic in the native scrolling control logic can be used to control the uniform scrolling of the page to avoid page jams. If the first difference is less than or equal to a preset threshold, considering that the difference between the first position and the second position is small, the possibility that the content displayed on the page scrolls to the boundary of the target content in the first direction is high, therefore, the initial operation position and the sliding offset of the operation can be obtained, and when the sliding offset is greater than the first difference, the page is controlled to scroll the first difference at a uniform speed, so that the page stops scrolling when its displayed content scrolls to the boundary of the target content in the first direction. With this solution, the page can stop scrolling when its displayed content scrolls to the boundary of the target content in the first direction without page freeze. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0052] Figure 1 A flow chart of a page scrolling control method provided in an embodiment of the present application;
[0053] Figure 2 A flowchart of another method for controlling page scrolling provided in an embodiment of the present application;
[0054] Figure 3 A schematic diagram of the structure of a page scrolling control device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0055] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution 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. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0056] Currently, users can control page scrolling by triggering corresponding operations. For example, users can use their fingers to trigger a sliding operation on the page, thereby triggering page scrolling. Among them, page scrolling can be considered as an inertial scrolling, which includes two stages, the first stage is a uniform speed scrolling stage, and the other stage is a uniform deceleration scrolling stage. In an example, the first stage corresponds to the time period from when the finger triggers a sliding operation on the page to when the finger leaves the page, and the second stage corresponds to the time period from when the finger leaves the page to when the page stops scrolling.
[0057] The inventor of the present application has found through research that when the client controls page scrolling, the native scrolling control logic can be used to control page scrolling. However, when the native scrolling control logic is used to control page scrolling, there will be a problem that the page display content has scrolled to the boundary of the page content, but the page continues to scroll, resulting in a poor user experience.
[0058] In one example, when controlling page scrolling, instead of using native scrolling logic, a new page scrolling control logic may be used, so that the page stops scrolling when the page display content has scrolled to the boundary of the page content. In a specific example, the display position of the page content when the user triggers the operation can be obtained, and the sliding offset can be periodically determined according to a certain period, so that the page scrolling can be controlled according to the sliding offset. For example, the sliding offset is determined every 15 milliseconds, so that the page scrolling can be controlled according to the sliding offset. However, in this way, when the client resources are insufficient, there will be a problem of page jamming. In one example, the aforementioned control logic for controlling page scrolling based on the sliding offset can be implemented by JavaScript, and it needs to rely on the JavaScript main thread. When JavaScript is occupied by other applications, it will cause JavaScript to have insufficient resources, resulting in page jamming.
[0059] In order to solve the above problems, an embodiment of the present application provides a method and device for controlling page scrolling.
[0060] Various non-limiting implementations of the present application are described in detail below in conjunction with the accompanying drawings.
[0061] Exemplary Methods
[0062] See also Figure 1 , which is a flow chart of a page scrolling control method provided in an embodiment of the present application.
[0063] The page scrolling control method provided in the embodiment of the present application can be applied to a client. In one example, the method can include the following steps: S101-S102a-S103 or S101-S102b.
[0064] S101: receiving an operation triggered on a page, wherein the operation is used to trigger the page to scroll in a first direction, and the page is used to display target content.
[0065] The page may be a page displayed by the client, and the page is used to display the target content. The page size is limited. In one example, all the contents of the target content cannot be displayed on the page at the same time. The user can trigger the page scrolling by triggering an operation on the page, so as to view the target content.
[0066] The user may trigger the operation through a touch device or other means. The touch device mentioned here may be a user's finger or a device such as a stylus. In one example, the user may use a finger to trigger a sliding operation on the page, thereby triggering the page to scroll in a first direction. In another example, the user may trigger the aforementioned operation on the page through a device such as a mouse. For example, the user may trigger the aforementioned operation by rolling the mouse, and in another example, the first user may control the mouse to drag the scroll bar on the page, thereby triggering the aforementioned operation.
[0067] The first direction in the embodiment of the present application may be a direction in which the page supports scrolling. In a vertical screen reading scenario, the page scrolls in the first direction, which may be an upward or downward scrolling of the page. In a horizontal screen reading scenario, the page scrolls in the first direction, which may be a left scrolling or a right scrolling of the page.
[0068] In one example, when the user triggers the operation, the content displayed in the target boundary area of the page is the first content in the target content. The target boundary area is the boundary area of the page in the second direction, and the first direction and the second direction are opposite. For example, when the operation is used to trigger the page to scroll up, the target boundary area is the lower boundary area of the page; for another example, when the operation is used to trigger the page to scroll down, the target boundary area is the upper boundary area of the page; for another example, when the operation is used to trigger the page to scroll to the left, the target boundary area is the right boundary area of the page; for another example, when the operation is used to trigger the page to scroll to the right, the target boundary area is the left boundary area of the page.
[0069] After receiving the operation, how to control the page scrolling can be determined according to the first difference between the first position and the second position of the first content in the target content. The second position is the boundary position of the target content corresponding to the second direction. Regarding the second position, in one example, when the operation is used to trigger the page to scroll up or to the left, the second position can be considered as the position where the target content ends (for example, the last row or the last column); in another example, when the operation is used to trigger the page to scroll down or to the right, the second position can be considered as the position where the target content starts (for example, the first row or the first column).
[0070] In one example, if the first difference is less than or equal to a preset threshold, it means that the first difference is small, and in this case, the page scrolling can be controlled through the following S102a-S103. If the first difference is greater than the preset threshold, it means that the first difference is large, and the page scrolling can be controlled through S102b.
[0071] The embodiments of the present application do not specifically limit the preset threshold value, and the preset threshold value can be set according to actual conditions. In one example, the preset threshold value can be the difference between the boundary of the page in the first direction and the boundary of the second direction. In the scenario of vertical screen reading, the preset threshold value can correspond to the height of the page.
[0072] S102a: In response to a first difference between the first position and the second position being less than or equal to a preset threshold, obtaining an initial operation position and a sliding offset of the operation, the target content including first content, the first position being a position of the first content displayed in a target boundary area of the page in the target content, the second position being a boundary position corresponding to the target content in the first direction, the target boundary area being a boundary area of the page in the second direction, and the first direction and the second direction being opposite.
[0073] S103: When the sliding offset is greater than the first difference, control the page to scroll at a uniform speed by the first difference.
[0074] As mentioned above, when the first difference is less than or equal to the preset threshold, it means that the first difference is small. In this case, when the user triggers the operation, the first content displayed in the target boundary area is close to the boundary of the target content in the first direction. Therefore, when the page is scrolled, the content displayed on the page is likely to scroll to the boundary of the target content in the first direction. In this case, in order to stop the page from scrolling when its displayed content scrolls to the boundary of the target content in the first direction, the client can obtain the initial operation position and sliding offset of the operation. Among them, the initial operation position of the operation can be the position of the first content displayed in the target boundary area of the page in the target content when the user starts to trigger the operation, that is, the aforementioned first position. The first position mentioned here can be, for example, the first content is located in the target content. In one example, the client can periodically obtain the sliding offset, for example, obtain the sliding offset every 15 milliseconds. In one example, the value of the sliding offset obtained each time is equal to the sum of the sliding offset obtained last time and the preset offset, and the sliding offset obtained for the first time is equal to the preset offset. The sliding offset is used to control page scrolling.
[0075] After the sliding offset is acquired, the magnitude relationship between the sliding offset and the first difference may be determined, and according to the magnitude relationship between the sliding offset and the first difference, how to control the page scrolling may be determined.
[0076] In one example, if the sliding offset is greater than the first difference, it means that when the page scrolling is controlled according to the sliding offset, there may be a situation where the displayed content of the page has scrolled to the boundary of the target content in the first direction, but the page continues to scroll. For example, in the scenario of controlling the page to scroll upward, the first difference corresponds to 10 lines, and the second difference corresponds to 8 lines. If the page is controlled to scroll 10 lines, it will scroll to the last line of the target content when it scrolls to the 8th line. Therefore, there will be a situation where the displayed content of the aforementioned page has scrolled to the boundary of the target content in the first direction, but the page continues to scroll. In this case, in order to avoid the above problem, the client can control the page to scroll the first difference at a uniform speed, so that when the displayed content of the page scrolls to the boundary of the target content in the first direction, the page stops scrolling.
[0077] In another example, if the sliding offset is less than or equal to the first difference, it means that the page scrolling is controlled according to the sliding offset, and there will be no situation where the displayed content of the page has scrolled to the boundary of the target content in the first direction, but the page continues to scroll. In this case, the client can control the page scrolling according to the sliding offset. In a specific example, the client can control the page to scroll at a constant speed by the sliding offset.
[0078] In one example, the page scrolling control logic of S102a-S103 can be implemented by JavaScript, and can occupy the main thread of JavaScript. In addition to being occupied by the page scrolling control logic, the main thread of JavaScript can also be occupied by other applications.
[0079] In one example, the client supports the native scroll control logic in addition to the page scroll control logic described in S102a-S103. In this case, the client can also disable the native scroll control logic before executing S102a to avoid conflicts between the two page scroll control logics.
[0080] Regarding the native scrolling control logic, it should be noted that, in one example, the native scrolling control logic may include a uniform scrolling control logic and a uniform deceleration scrolling control logic, the uniform scrolling control logic may be used to control the page scrolling in the first stage mentioned above, and the uniform deceleration scrolling control logic may be used to control the page scrolling in the second stage mentioned above. Regarding the specific implementation of the native scrolling control logic, for example, a mature native scrolling control logic may be adopted, which will not be described in detail here.
[0081] S102b: In response to the first difference being greater than the preset threshold, using a uniform scrolling control logic in a native scrolling control logic to control the page to scroll at a uniform speed.
[0082] As mentioned above, when the first difference is greater than the preset threshold, it means that the first difference is large. In this case, when the user triggers the operation, the first content displayed in the target boundary area is far away from the boundary of the target content in the first direction. Therefore, when scrolling the page, the possibility of the content displayed on the page scrolling to the boundary of the target content in the first direction is small. In this case, in order to ensure the smoothness of page scrolling, the uniform scrolling control logic in the native scrolling control logic can be used to control the uniform scrolling of the page.
[0083] It can be seen from the above description that, using the solution of the embodiment of the present application, when the aforementioned first difference is greater than the preset threshold, the uniform scrolling control logic in the native scrolling control logic is used to control the page to scroll at a uniform speed, thereby ensuring the smoothness of the page scrolling. When the aforementioned first difference is less than or equal to the preset threshold, the page scrolling is controlled according to the size relationship between the sliding offset and the first difference, so that the page stops scrolling when its displayed content scrolls to the boundary of the target content in the first direction. Using this solution, the page can stop scrolling when its displayed content scrolls to the boundary of the target content in the first direction while avoiding page jams.
[0084] As mentioned above, page scrolling may include two stages. In the embodiment of the present application, the client uses Figure 1 After the method shown controls the page to scroll at a constant speed, it can also control the page to move at a constant deceleration speed.
[0085] In one example, considering that when the native scrolling control logic is used to control the scrolling of the page, it is impossible to control the page to stop scrolling when its displayed content scrolls to the boundary of the target content in the first direction. Therefore, as an example, when the uniform scrolling control logic in the native scrolling control logic is used to control the uniform scrolling of the page, the uniform deceleration scrolling control logic in the native scrolling control logic can also be disabled, so as to avoid using the uniform deceleration scrolling control logic to control the uniform deceleration movement of the page after the uniform scrolling of the page ends, so as to avoid the page still continuing to scroll when its displayed content scrolls to the boundary of the target content in the first direction.
[0086] In one example, the client can also execute Figure 2 S201-S203 shown in the figure make the page stop scrolling when its displayed content scrolls to the boundary of the target content in the first direction. Figure 2 A flowchart of another page scrolling control method provided in an embodiment of the present application.
[0087] S201: Acquire a first scrolling distance and a first scrolling time of a page scrolling at a uniform speed.
[0088] In one example, when controlling the page to scroll at a constant speed, the time of the page scrolling at a constant speed and the first scrolling distance of the page scrolling at a constant speed may be recorded.
[0089] In one example, the first scrolling distance of the page scrolling at a uniform speed may be the aforementioned scrolling offset. In another example, the first scrolling distance of the page scrolling at a uniform speed may be determined based on the initial operation position of the operation and the end operation position of the operation. For example, the first scrolling distance may be determined based on the difference between the end operation position and the initial operation position. The end operation position mentioned here may be the position of the second content displayed in the target boundary area of the page in the target content when the user ends the operation, that is, the third position mentioned later. The third position mentioned here may, for example, be the row number of the target content where the second content is located.
[0090] S202: In response to the operation being completed, determining a second scrolling distance of uniformly decelerating scrolling according to the first scrolling distance and the first scrolling time.
[0091] When the operation ends, the client can determine the second scrolling distance of the uniformly decelerated scrolling according to the aforementioned first scrolling distance and the first scrolling time in response to the end of the operation. Specifically, according to the first scrolling distance and the first scrolling time, the speed of the uniformly decelerated scrolling can be obtained as: first scrolling distance / first scrolling time, and accordingly, the initial speed of the uniformly decelerated scrolling can be obtained as: first scrolling distance / first scrolling time. According to the initial speed of the uniformly decelerated scrolling, the second scrolling distance of the page scrolling from the initial speed to 0 can be obtained. In an example, the second scrolling distance can be calculated by the following formula (1).
[0092]
[0093] In formula (1):
[0094] S is the second rolling distance;
[0095] v is the initial velocity;
[0096] a is the acceleration of uniform deceleration, and the acceleration is a preset value less than 0. For example, the acceleration may be equal to -0.0015.
[0097] S203: If the second difference between the third position and the second position is less than or equal to the second scrolling distance, the page is controlled to scroll the second difference at a uniform deceleration rate, the third position being the position of the second content displayed in the target boundary area in the target content, and the second content being the content displayed in the target boundary area when the page ends scrolling at a uniform speed.
[0098] After obtaining the second scrolling distance, the magnitude relationship between the second difference between the third position and the second position and the second scrolling distance may be further determined, thereby determining how to control the page scrolling.
[0099] In one example, if the second difference is less than or equal to the second scrolling distance, it means that when the page scrolling is controlled according to the second scrolling distance, there may be a situation where the displayed content of the page has scrolled to the boundary of the target content in the first direction, but the page continues to scroll. For example, in the scenario of controlling the page to scroll upward, the second difference corresponds to 10 lines, and the second scrolling distance corresponds to 12 lines. If the page is controlled to scroll 12 lines, it will have scrolled to the last line of the target content when it scrolls to the 10th line. Therefore, there may be a situation where the displayed content of the aforementioned page has scrolled to the boundary of the target content in the first direction, but the page continues to scroll. In this case, in order to avoid the above problem, the client can control the page to scroll the second difference with a uniform deceleration, so that when the displayed content of the page scrolls to the boundary of the target content in the first direction, the page stops scrolling.
[0100] In one example, while controlling the page to scroll at a uniform deceleration, the distance of the page's uniform deceleration scrolling can be recorded, and when the distance of the page's uniform deceleration scrolling reaches the second difference, the page can be controlled to stop scrolling, thereby controlling the page to scroll at a uniform deceleration by the second difference.
[0101] In another example, the second scrolling time can be determined based on the acceleration of the uniformly decelerated scrolling and the second difference. Furthermore, while controlling the uniformly decelerated scrolling of the page, the time for controlling the uniformly decelerated scrolling of the page is recorded. When the uniformly decelerated scrolling time of the page reaches the second scrolling time, the page is controlled to stop scrolling, thereby achieving the goal of controlling the page to uniformly scroll the second difference.
[0102] As an example, the second rolling time can be calculated using formula (2):
[0103]
[0104] In formula (2):
[0105] t is the second rolling time;
[0106] S is the second rolling distance, which can be calculated according to formula (1);
[0107] a is the acceleration of uniform deceleration, and its value is the same as that of a in formula (1).
[0108] In another example, if the second difference is greater than the second scrolling distance, it means that the page scrolling is controlled according to the second scrolling distance, and there will not be a situation where the displayed content of the page has scrolled to the boundary of the target content in the first direction, but the page continues to scroll. In this case, the client can control the page scrolling according to the second scrolling distance. In a specific example, the client can control the page to scroll the second scrolling distance at a uniform deceleration.
[0109] In an example, the page may be controlled to scroll at a uniform deceleration until the scrolling speed of the page drops to 0, thereby controlling the page to scroll at a uniform deceleration for the second scrolling distance.
[0110] In another example, a third scrolling time can be determined based on the acceleration of the uniformly decelerated scrolling and the second scrolling distance. Furthermore, while controlling the uniformly decelerated scrolling of the page, the time for controlling the uniformly decelerated scrolling of the page is recorded. When the uniformly decelerated scrolling time of the page reaches the third scrolling time, the page is controlled to stop scrolling, thereby controlling the page to scroll the second scrolling distance at a uniformly decelerated speed.
[0111] In one example, if the native scroll control logic is disabled when controlling page scrolling, the disablement can be lifted at an appropriate time to facilitate subsequent control of page scrolling based on the native scroll control logic. For example, the disablement can be lifted after executing S203, or after executing S103, which is not specifically limited in the embodiments of the present application.
[0112] Exemplary Devices
[0113] Based on the page scrolling control method provided in the above embodiment, the embodiment of the present application also provides a corresponding device, and the device is introduced next in conjunction with the accompanying drawings.
[0114] See also Figure 3 , which is a structural schematic diagram of a page scrolling control device provided in an embodiment of the present application. Figure 3 The page scrolling control device shown in the figure can be used to execute the page scrolling control method provided in the above embodiment. Figure 3 As shown:
[0115] The page scrolling control device 300 includes: a receiving unit 301 and a processing unit 302 .
[0116] A receiving unit 301 is used to receive an operation triggered on a page, where the operation is used to trigger the page to scroll in a first direction, and the page is used to display target content;
[0117] The processing unit 302 is configured to:
[0118] In response to a first difference between the first position and the second position being less than or equal to a preset threshold, obtaining an initial operation position and a sliding offset of the operation, and when the sliding offset is greater than the first difference, controlling the page to scroll the first difference at a uniform speed, the target content includes the first content, the first position is a position of the first content displayed in a target boundary area of the page in the target content, the second position is a boundary position corresponding to the target content in the second direction, the target boundary area is a boundary area of the page in the second direction, and the first direction is opposite to the second direction;
[0119] or,
[0120] In response to the first difference being greater than the preset threshold, the page is controlled to scroll at a uniform speed using a uniform scrolling control logic in a native scrolling control logic.
[0121] Optionally, the device further comprises:
[0122] An acquisition unit, used for acquiring a first scrolling distance and a first scrolling time of the page being scrolled at a uniform speed;
[0123] A determining unit, configured to determine, in response to the operation being ended, a second scrolling distance of uniformly decelerated scrolling according to the first scrolling distance and the first scrolling time;
[0124] A first control unit is used to control the page to scroll the second difference at a uniform deceleration if a second difference between the third position and the second position is less than or equal to the second scrolling distance, the third position being a position of the second content displayed in the target boundary area in the target content, and the second content being the content displayed in the target boundary area when the uniform scrolling of the page ends.
[0125] Optionally, the first control unit is used to:
[0126] determining a second scrolling time according to the uniformly decelerated scrolling acceleration and the second difference;
[0127] The page is controlled to scroll at the uniformly decelerated speed for the second scrolling time.
[0128] Optionally, the device further comprises:
[0129] The first native disabling unit is configured to disable the native scroll control logic in response to the first difference being less than or equal to the preset threshold.
[0130] Optionally, the device further comprises:
[0131] The second native disabling unit is configured to disable the uniform deceleration scrolling control logic in the native scrolling control logic in response to the first difference being greater than the preset threshold.
[0132] Optionally, the device further comprises:
[0133] The second control unit is used to control the page to scroll the sliding offset at a uniform speed when the sliding offset is less than or equal to the first difference.
[0134] Optionally, the preset threshold is a difference between a boundary of the page in the first direction and a boundary of the page in the second direction.
[0135] Since the device 300 is a device corresponding to the method provided in the above method embodiment, the specific implementation of each unit of the device 300 is based on the same concept as the above method embodiment. Therefore, for the specific implementation of each unit of the device 300, reference can be made to the description part of the above method embodiment, which will not be repeated here.
[0136] The embodiment of the present application also provides a device, the device comprising a processor and a memory;
[0137] The processor is used to execute the instructions stored in the memory, so that the device executes the page scrolling control method provided by the above method embodiment.
[0138] An embodiment of the present application provides a computer-readable storage medium, including instructions, wherein the instructions instruct a device to execute the page scrolling control method provided in the above method embodiment.
[0139] An embodiment of the present application provides a computer program product. When the computer program product is run on a computer, the computer executes the page scrolling control method provided by the above method embodiment.
[0140] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.
[0141] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
[0142] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application.
Claims
1. A method for controlling page scrolling, characterized in that: The method comprises: receiving an operation triggered on a page, the operation being used to trigger the page to scroll in a first direction, the page being used to display target content; In response to a first difference between the first position and the second position being less than or equal to a preset threshold, obtaining an initial operation position and a sliding offset of the operation, and when the sliding offset is greater than the first difference, controlling the page to scroll the first difference at a uniform speed, the target content includes the first content, the first position is a position of the first content displayed in a target boundary area of the page in the target content, the second position is a boundary position corresponding to the target content in the second direction, the target boundary area is a boundary area of the page in the second direction, and the first direction is opposite to the second direction; or, In response to the first difference being greater than the preset threshold, the page is controlled to scroll at a uniform speed using a uniform scrolling control logic in a native scrolling control logic.
2. The method according to claim 1, characterized in that The method further comprises: Obtaining a first scrolling distance and a first scrolling time of the page scrolling at a uniform speed; In response to the operation being ended, determining a second scrolling distance of uniformly decelerated scrolling according to the first scrolling distance and the first scrolling time; If a second difference between the third position and the second position is less than or equal to the second scrolling distance, the page is controlled to scroll the second difference at a uniform deceleration rate, the third position being the position of the second content displayed in the target boundary area in the target content, and the second content being the content displayed in the target boundary area when the uniform scrolling of the page ends.
3. The method according to claim 2, characterized in that The controlling the page to scroll the second difference at a uniform deceleration rate includes: determining a second scrolling time according to the uniformly decelerated scrolling acceleration and the second difference; The page is controlled to scroll at the uniformly decelerated speed for the second scrolling time.
4. The method according to claim 1, characterized in that: The method further comprises: In response to the first difference being less than or equal to the preset threshold, disabling native scroll control logic.
5. The method according to claim 1, characterized in that The method further comprises: In response to the first difference being greater than the preset threshold, disabling the uniform deceleration scrolling control logic in the native scrolling control logic.
6. The method according to claim 1, characterized in that The method further comprises: When the sliding offset is less than or equal to the first difference, the page is controlled to scroll the sliding offset at a uniform speed.
7. The method according to claim 1, characterized in that The preset threshold is a difference between a boundary of the page in the first direction and a boundary of the page in the second direction.
8. A page scrolling control device, characterized in that: The device comprises: A receiving unit, configured to receive an operation triggered on a page, wherein the operation is used to trigger the page to scroll in a first direction, and the page is used to display target content; A processing unit for: In response to a first difference between the first position and the second position being less than or equal to a preset threshold, obtaining an initial operation position and a sliding offset of the operation, and when the sliding offset is greater than the first difference, controlling the page to scroll the first difference at a uniform speed, the target content includes the first content, the first position is a position of the first content displayed in a target boundary area of the page in the target content, the second position is a boundary position corresponding to the target content in the second direction, the target boundary area is a boundary area of the page in the second direction, and the first direction is opposite to the second direction; or, In response to the first difference being greater than the preset threshold, the page is controlled to scroll at a uniform speed using a uniform scrolling control logic in a native scrolling control logic.
9. A device, characterized in that: The device comprises a processor and a memory; The processor is configured to execute instructions stored in the memory, so that the device performs the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The method comprises instructions for instructing a device to execute the method according to any one of claims 1 to 7.
