WO2019090996A1 - Method, device and equipment for preventing interface from shaking, and computer-readable storage medium - Google Patents

Method, device and equipment for preventing interface from shaking, and computer-readable storage medium Download PDF

Info

Publication number
WO2019090996A1
WO2019090996A1 PCT/CN2018/075043 CN2018075043W WO2019090996A1 WO 2019090996 A1 WO2019090996 A1 WO 2019090996A1 CN 2018075043 W CN2018075043 W CN 2018075043W WO 2019090996 A1 WO2019090996 A1 WO 2019090996A1
Authority
WO
WIPO (PCT)
Prior art keywords
sliding
currently generated
track
contact
average
Prior art date
Application number
PCT/CN2018/075043
Other languages
French (fr)
Chinese (zh)
Inventor
陈建波
Original Assignee
平安科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2019090996A1 publication Critical patent/WO2019090996A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0484Interaction techniques based on graphical user interfaces [GUI] for the control of specific functions or operations, e.g. selecting or manipulating an object, an image or a displayed text element, setting a parameter value or selecting a range

Definitions

  • the present application relates to the field of information processing technologies, and in particular, to a method, an apparatus, a device, and a computer readable storage medium for preventing interface jitter.
  • the webview control itself has the effect of sliding up and down when displaying the page.
  • the webview control is a container, there are other tags inside it, such as a label for displaying the image, and the label of the displayed image has the effect of sliding left and right.
  • the webview control is a container, there are other tags inside it, such as a label for displaying the image, and the label of the displayed image has the effect of sliding left and right.
  • the webview control is a container, there are other tags inside it, such as a label for displaying the image, and the label of the displayed image has the effect of sliding left and right.
  • the image of the carousel has the effect of sliding left and right.
  • the user's actions are random. If the user's finger slides up and down and left and right in a short period of time, the terminal interface will experience jitter.
  • the sliding event can achieve the left and right sliding effect, and the webview control itself triggers its corresponding sliding event.
  • the sliding event can achieve the effect of sliding up and down, then it will detect that both the left and right sliding and the vertical sliding, the terminal will appear jitter, affecting the user experience.
  • the embodiments of the present invention provide a method, an apparatus, a device, and a computer readable storage medium for preventing interface jitter, which can prevent jitter of a terminal interface caused by multiple sliding events when multiple sliding events exist simultaneously in the control.
  • an embodiment of the present application provides a method for preventing interface jitter, where the method includes:
  • the sliding direction is calculated according to the currently generated sliding track
  • the sliding direction of the sliding event of the mutex is added as the direction of the sliding operation and reported to the control, so that the control responds to the current sliding operation;
  • an embodiment of the present application provides an apparatus for preventing interface jitter, the apparatus comprising means for performing the method for preventing interface jitter described in the first aspect above.
  • the embodiment of the present application further provides a computer device, where the computer device includes a memory, and a processor connected to the memory;
  • the memory is for storing a computer program that implements prevention of interface jitter, the processor for running a computer program stored in the memory to perform the method of preventing interface jitter described in the first aspect above.
  • an embodiment of the present application provides a computer readable storage medium, where the computer readable storage medium stores a computer program, where the computer program includes program instructions, and when the program instructions are executed by a processor, implementing the foregoing The method of preventing interface jitter described in the first aspect.
  • the sliding time and the sliding track of the sliding operation are acquired; if the sliding time reaches a preset time and the sliding operation is not ended Calculating a sliding direction according to the currently generated sliding track; adding a mutex to the same sliding event as the sliding direction; controlling the control to respond to the sliding event with the mutex added; if the sliding operation ends, Release the mutex.
  • the control by calculating a sliding direction within a preset time and adding a mutex to the sliding event with the same sliding direction, the control only responds to the sliding of the sliding event with the mutex, thus avoiding The jitter of the terminal interface caused by a plurality of sliding events in different directions triggered by the sliding operation.
  • FIG. 1 is a schematic flowchart of a method for preventing interface jitter provided by an embodiment of the present application
  • FIG. 2 is a schematic diagram of a sub-flow of a method for preventing interface jitter provided by an embodiment of the present application
  • Figure 3 is a schematic diagram of a sub-flow of the method shown in Figure 2;
  • FIG. 4 is a schematic diagram of a sub-flow of a method for preventing interface jitter provided by an embodiment of the present application
  • FIG. 5 is a schematic diagram of a sub-flow of a method for preventing interface jitter according to another embodiment of the present application.
  • FIG. 6 is a schematic block diagram of an apparatus for preventing interface jitter provided by an embodiment of the present application.
  • FIG. 7 is a schematic block diagram of a computing unit provided by an embodiment of the present application.
  • FIG. 8 is a schematic block diagram of an average direction calculation unit provided by an embodiment of the present application.
  • FIG. 9 is a schematic block diagram of a locking unit provided by an embodiment of the present application.
  • FIG. 10 is a schematic block diagram of a computing unit provided by another embodiment of the present application.
  • FIG. 11 is a schematic block diagram of a computer device according to an embodiment of the present application.
  • first, second, etc. may be used herein to describe various elements, these elements should not be limited to these terms. These terms are only used to distinguish these elements from each other.
  • first included angle may be referred to as a second included angle without departing from the scope of the present application, and similarly, the second included angle may be referred to as a first included angle.
  • the first angle and the second angle are both included, but they are not the same angle.
  • FIG. 1 is a schematic flow chart of a method for preventing interface jitter provided by an embodiment of the present application.
  • the method runs in a terminal with a control installed, and the control has a sliding effect of up, down, left, and right. As shown in FIG. 1, the method includes S101-S105.
  • the webview control itself has the effect of sliding up and down when displaying the page.
  • the webview control is a container, there are other tags inside it, such as a label showing the carousel image, the round The broadcasted image has the effect of sliding left and right. If the user's finger is placed on the carousel image and slides obliquely, the picture tag triggers its corresponding sliding event, and the sliding event can achieve the left and right sliding effect, and the webview control itself also triggers its corresponding sliding event.
  • the sliding event can achieve the effect of sliding up and down, then two sliding events will be detected at the same time: the sliding event corresponding to the image tag and the sliding event corresponding to the webview control itself. It should be noted that this is not the true meaning of the CPU on the terminal at the same time. In fact, the time to detect two sliding events on the control is sequential, but the time interval is very short and the CPU can ignore it.
  • the sliding time and the sliding track of the sliding operation are obtained. If the user's finger slides obliquely, the sliding time and the sliding trajectory of the sliding operation corresponding to the oblique sliding are obtained.
  • the sliding time is a time when the sliding event is detected when the plurality of sliding events exist at the same time, and the corresponding sliding operation continues until the current time; the sliding track corresponds to the sliding track during the sliding time, wherein the sliding track includes the sliding contact .
  • a sliding contact refers to a point that can be identified in contact with the terminal during a sliding operation, typically a sliding track comprising a plurality of sliding contacts.
  • the sliding operation may further include a plurality of corresponding sliding operations caused by the simultaneous sliding of the two hands of the user, and the area operated by the two hands of the user belongs to an area in the control that can trigger multiple sliding events. If there are multiple sliding operations, such as sliding operations corresponding to two fingers, the corresponding sliding time is acquired, and the sliding trajectories of the sliding operations corresponding to each finger in the corresponding sliding time are respectively acquired.
  • the sliding direction is calculated according to the currently generated sliding track.
  • the preset time can be 200ms. If the sliding time reaches the preset time and the sliding operation is not finished, if it is detected that the user's finger does not leave the area where the control is located, the sliding direction is calculated according to the currently generated sliding track; otherwise, the sliding operation is not responded. That is, when the sliding time reaches the preset time, the sliding operation has ended. If the sliding time reaches the preset time, the user's finger is detected to leave the area where the control is located, and the sliding time has not reached the preset time and the sliding operation has ended, such as the sliding time. If the user's finger is detected when the preset time is not reached, the area where the control is located does not respond to the sliding operation.
  • step S102 includes S201-S202.
  • the generated sliding track can be understood as the sliding track generated by the sliding operation when the preset time is reached.
  • the terminal screen slides to the right as the positive direction of the x-axis
  • the screen slides up to the positive direction of the y-axis
  • the lower left corner of the screen is the coordinate axis of the origin of the coordinate
  • the preset axis is the x-axis
  • the direction of the preset axis is the x-axis.
  • step S201 includes S301-S304.
  • a plurality of sliding contacts may be collected in an equal time interval according to the currently generated sliding track, or a plurality of sliding contacts may be collected in an equidistantly spaced manner according to the currently generated sliding track.
  • the equidistant intervals may be equal distance intervals in the x-axis direction of the preset axis, or may be equal distance intervals in the y-axis direction.
  • the plurality of sliding contacts may be 50 sliding contacts.
  • S302. Determine an angle between a line connecting two adjacent sliding contacts and a preset axis.
  • the preset axis is the x-axis
  • the direction of the preset axis is the positive direction of the x-axis.
  • Adjacent two sliding contacts refer to adjacent sliding contacts on the sliding track produced by the same sliding operation.
  • the preset axis may be the x-axis and the direction is the x-axis negative direction; the preset axis may also be the y-axis, and the direction is the positive direction of the y-axis or the negative direction of the y-axis.
  • S304 determining an average direction of the sliding operation that has been performed according to an average value of all the included angles and a direction of the preset axis. Specifically, if the average value of all the included angles is between 315 degrees and 45 degrees, the average direction of the sliding operation that has been performed is the same as the direction of the preset axis (the positive direction of the x-axis); if the average range of all the included angles Between 135 and 225 degrees, the average direction of the sliding operation that has been performed is opposite to the direction of the preset axis (the positive x-axis direction); otherwise, the sliding direction is in the vertical direction of the preset axis.
  • the average direction of the sliding operation that has been performed is the same as the positive direction of the y-axis; if the average of all the angles ranges from 225 degrees to 315 degrees, The average direction of the sliding operation performed is opposite to the positive direction of the y-axis.
  • the average direction of the sliding operation that has been performed is calculated according to the sliding trajectory currently generated by the one sliding operation, and the sliding direction of the sliding operation that has been performed within the preset time is determined according to the average direction. If there are multiple sliding operations detected, such as two sliding operations, respectively, multiple sliding contacts on the sliding track currently generated by the two sliding operations are acquired, and then two adjacent sliding contacts on each sliding track are determined.
  • the angle between the line of the point and the preset axis, and the average of all the angles determined on each of the sliding tracks are calculated to obtain two average values, which are referred to as a first average value and a second average value, respectively.
  • the first average is 42 degrees and the second average is 60 degrees.
  • the sliding directions of the two sliding events are respectively sliding to the right and sliding upward, if the sliding direction calculated according to the currently generated sliding track is sliding upward, the sliding event of the upward sliding is added with a mutex.
  • Mutexes are also called exclusive locks, exclusive locks, and so on. If a mutex is created, the control can only respond to a sliding event at the same time. For example, a sliding event with a mutex is always responded, and other sliding events are not responded.
  • step S103 includes S401-S403.
  • mutex of the control If the mutex of the control is not created, create a mutex of the control.
  • the mutex of the control can already exist. It can be understood that the mutex of the control has been created before the step is executed. If the control's mutex does not exist, you need to create a mutex of the control, which can be understood as creating a mutex that controls the response to the sliding event.
  • the control control responds to the sliding event with the mutex added. If the swipe operation is not over, the control control only responds to the sliding event with the mutex added. If the sliding direction of the mutex with the mutex is swiped up before the mutex is added, and the mutex is still swiped up after the mutex is locked, the sliding direction corresponding to the upward sliding is reported to the control, so that the control responds to the sliding The event slides up. If the sliding direction of the sliding event of the mutex is swiped up before the mutex is added, and sliding down after a period of time after the mutex is applied, the sliding direction corresponding to the downward sliding in the time is reported to Controls to make the control slide down in response to the sliding event. In this way, the accuracy of the control's response to the sliding event can be improved.
  • the mutex is released. Among them, the release can be understood as release or destruction. If there are multiple sliding operations, such as two sliding operations, the sliding operation ends, it can be understood that both sliding operations have ended, or one of the sliding operations ends. One of the sliding operations ends, which is regarded as the end of the sliding operation. It can be understood that if there is only one sliding operation, the control only needs to respond to the sliding event of the sliding operation. There are no multiple sliding events, and there is no jitter. The situation is gone.
  • the above embodiment obtains the sliding time and the sliding track of the sliding operation when detecting a plurality of sliding events triggered by the sliding operation on the control; if the sliding time reaches the preset time and the sliding operation is not ended Calculating the sliding direction according to the currently generated sliding track; adding a mutex to the same sliding event as the sliding direction; the control control responds to the sliding event with the mutex added; if the sliding operation ends, the lifting The mutex is described.
  • the control by calculating a sliding direction within a preset time and adding a mutex to the sliding event with the same sliding direction, the control only responds to the sliding of the sliding event with the mutex, thus avoiding The jitter of the terminal interface caused by multiple sliding events triggered by the sliding operation.
  • the sliding direction calculated according to the currently generated sliding trajectory is used as the sliding direction of the sliding event of the mutex.
  • control the control to respond to the sliding direction.
  • the sliding direction calculated according to the currently generated sliding trajectory can be used as the mutex added.
  • the sliding direction of the sliding event In the time when the sliding event holds the mutex, no matter how long the sliding operation is detected, the sliding direction calculated only according to the currently generated sliding trajectory is used as the sliding direction of the sliding event of the mutex. Report the sliding direction to the control so that the control responds to the sliding event with the mutex added. In this way, it is not necessary to obtain the sliding contact of the corresponding sliding operation and calculate the sliding direction of the sliding operation after the sliding event is added with the mutex, which saves the calculation amount and the storage amount, and also saves the power of the terminal.
  • FIG. 5 is a schematic diagram of a sub-flow of a method for preventing interface jitter provided by an embodiment of the present application. As shown in FIG. 5, the sliding direction is calculated based on the currently generated sliding trajectory, including S501-S502.
  • determining the sliding direction of the sliding operation according to the first contact and the second contact comprises: determining a sliding direction of the sliding operation according to a direction of a straight line where the first contact and the second contact are located. If there is only one sliding operation, the first contact corresponding to the sliding operation is connected with the second contact, and the angle between the connecting line and the preset axis is calculated, according to the angle between the connecting line and the preset axis, and The direction of the preset axis determines the direction of the slide.
  • the sliding direction is the same as the direction of the preset axis, that is, the sliding direction of the sliding operation is determined to slide to the right; if the angle ranges from 135 degrees to 225 degrees Between the sliding direction and the direction of the preset axis, that is, the sliding direction of the sliding operation is determined to be sliding to the left; if the angle is between 45 and 135 degrees, it is determined that the sliding direction of the sliding operation is the same as the positive direction of the y-axis , that is, sliding upward; if the angle is between 225 degrees and 315 degrees, it is determined that the sliding direction of the sliding operation is opposite to the positive direction of the y-axis, that is, sliding downward.
  • the first contact corresponding to one sliding operation is first connected with the second contact, and the angle between the connecting line and the preset axis is calculated, which is called the first An angle, such as the first angle is 42 degrees.
  • the first contact corresponding to the other sliding operation is connected with the second contact, and the angle between the connection and the preset axis is calculated, which is called the second angle, and the second angle is 60 degrees.
  • the embodiment calculates the angle between the direction of the straight line where the first contact and the second contact is located and the preset axis by acquiring the first contact at the start of the sliding and the second contact when the preset time is reached, according to This angle determines the sliding direction of the sliding operation.
  • determining the sliding direction of the sliding operation based on the first contact and the second contact comprises determining a sliding direction of the sliding operation based on a vector of straight lines in which the first contact and the second contact are located. If there is only one sliding operation, the components in different directions on the coordinate axis are calculated from the vectors of the straight lines in which the first contact and the second contact are located. If the component on the x-axis is larger than the component on the y-axis and the direction of the vector is to the right, then the sliding direction of the sliding operation that has been performed is determined to be rightward, if the component on the y-axis is larger than the component on the x-axis. And the direction of the vector is upward, then it is determined that the sliding direction of the sliding operation that has been performed is upward.
  • the sliding directions of the sliding operations corresponding to the angles are determined according to a preset rule. For example, it is determined according to the sliding direction of the sliding operation at the previous moment (or the first N moments) or a direction is randomly selected. If the sliding direction of the sliding operation is determined according to the previous moment (or the first N moments), then the sliding direction of the sliding operation at the previous moment (or the first N moments) is the upward sliding, then the angles corresponding to the sliding operation at the time point The sliding direction is upward.
  • FIG. 6 is a schematic block diagram of an apparatus for preventing interface jitter provided by an embodiment of the present application.
  • the device 60 includes an acquisition unit 601, a calculation unit 602, a lock unit 603, a control unit 604, and an unlock unit 605.
  • the obtaining unit 601 is configured to obtain a sliding time and a sliding track of the sliding operation if a plurality of sliding events triggered by the sliding operation on the control are detected.
  • the calculating unit 602 is configured to calculate the sliding direction according to the currently generated sliding track if the sliding time reaches the preset time and the sliding operation is not ended.
  • the calculation unit 602 includes an average direction calculation unit 701 and a first determination unit 702.
  • the calculating unit 602 is configured to calculate a sliding direction according to the currently generated sliding trajectory.
  • the average direction calculation unit 701 is configured to calculate an average direction of the sliding operation that has been performed according to the currently generated sliding track. As shown in FIG. 8, the average direction calculation unit 701 includes an acquisition unit 801, an angle determination unit 802, an average angle calculation unit 803, and an average direction determination unit 804.
  • the collecting unit 801 is configured to collect a plurality of sliding contacts according to the currently generated sliding track. Optionally, a plurality of sliding contacts may be collected in an equal time interval according to the currently generated sliding track, or a plurality of sliding contacts may be collected in an equidistantly spaced manner according to the currently generated sliding track.
  • the equidistant intervals may be equal distance intervals in the x-axis direction of the preset axis, or may be equal distance intervals in the y-axis direction.
  • the included angle determining unit 802 is configured to determine an angle between a line connecting two adjacent sliding contacts and a preset axis.
  • the average angle calculation unit 803 is for calculating an average value of all the angles that have been determined.
  • the average direction determining unit 804 determines the average direction of the sliding operation that has been performed based on the average value of all the included angles and the direction of the preset axis.
  • the first determining unit 702 is configured to determine a sliding direction of the sliding operation that has been performed according to the average direction.
  • the locking unit 603 is configured to add a mutex to the same sliding event as the sliding direction. If the sliding directions of the two sliding events are respectively sliding to the right and sliding upward, if the sliding direction calculated according to the currently generated sliding track is sliding upward, the sliding event of the upward sliding is added with a mutex. Mutexes are also called exclusive locks, exclusive locks, and so on. If a mutex is created, the control can only respond to a sliding event at the same time. For example, a sliding event with a mutex is always responded, and other sliding events are not responded.
  • the locking unit 603 includes a mutex determining unit 901, a mutex creating unit 902, and a mutex adding unit. 903.
  • the mutex lock determining unit 901 is configured to determine whether a mutex of the control is created.
  • the mutex lock creating unit 902 is configured to create a mutex of the control if the mutex of the control is not created.
  • the mutex lock adding unit 903 is configured to add the acquired mutex to the same sliding event as the sliding direction. It can be understood that the same sliding event as the sliding direction is always responded. The sliding operation is not responded to within the preset time before the mutex is added.
  • the control unit 604 is configured to control the control to respond to the sliding event to which the mutex has been added.
  • the unlocking unit 605 is configured to release the mutex if it detects the end of the sliding operation.
  • the control unit calculates the sliding direction according to the currently generated sliding trajectory as a mutex plus The sliding direction of the sliding event and the control controls respond to the sliding direction.
  • FIG. 10 is a schematic block diagram of a computing unit 602 provided by another embodiment of the present application.
  • the calculating unit 602 is configured to calculate a sliding direction according to the currently generated sliding trajectory.
  • the calculation unit 602 includes a contact acquisition unit 101 and a second determination unit 102.
  • the contact acquiring unit 101 is configured to acquire the first contact at the start of the sliding trajectory and the second contact when the preset time is reached according to the currently generated sliding trajectory.
  • the second determining unit 102 is configured to determine a sliding direction of the sliding operation according to the first contact and the second contact.
  • determining the sliding direction of the sliding operation based on the first contact and the second contact comprises determining a sliding direction of the sliding operation based on a vector of straight lines in which the first contact and the second contact are located. If there is only one sliding operation, the components in different directions on the coordinate axis are calculated from the vectors of the straight lines in which the first contact and the second contact are located. If the component on the x-axis is larger than the component on the y-axis and the direction of the vector is to the right, then the sliding direction of the sliding operation that has been performed is determined to be rightward, if the component on the y-axis is larger than the component on the x-axis. And the direction of the vector is upward, then it is determined that the sliding direction of the sliding operation that has been performed is upward.
  • the sliding directions of the sliding operations corresponding to the angles are determined according to a preset rule. For example, it is determined according to the sliding direction of the sliding operation at the previous moment (or the first N moments) or a direction is randomly selected. If the sliding direction of the sliding operation is determined according to the previous moment (or the first N moments), then the sliding direction of the sliding operation at the previous moment (or the first N moments) is the upward sliding, then the angles corresponding to the sliding operation at the time point The sliding direction is upward.
  • the above described means for preventing interface jitter can be implemented in the form of a computer program that can be run on a computer device as shown in FIG.
  • FIG. 11 is a schematic block diagram of a computer device according to an embodiment of the present application.
  • the computer device 110 can be a terminal.
  • the computer device 110 includes a processor 112, a memory, and a network interface 113 that are coupled by a system bus 111, wherein the memory can include a non-volatile storage medium 114 and an internal memory 115.
  • the non-volatile storage medium 114 can store an operating system 1141 and a computer program 1142.
  • the processor 112 can be caused to perform a method of preventing interface jitter.
  • the processor 112 is used to provide computing and control capabilities to support the operation of the entire computer device 110.
  • the internal memory 115 provides an environment for the operation of a computer program in a non-volatile storage medium that, when executed by the processor 112, causes the processor 112 to perform a method of preventing interface jitter.
  • the network interface 113 is used for network communication. It will be understood by those skilled in the art that the structure shown in FIG. 11 is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation of the computer device 110 to which the solution of the present application is applied, and a specific computer device. 110 may include more or fewer components than shown, or some components may be combined, or have different component arrangements.
  • the processor 112 is configured to run a computer program stored in the memory to implement the following steps:
  • the sliding track calculates a sliding direction; adding a mutex to the same sliding event as the sliding direction; controlling the control to respond to a sliding event to which the mutex has been added; and if detecting the sliding operation ending, releasing the mutual Rebel lock.
  • the average direction of the sliding operation that has been performed is calculated based on the currently generated sliding trajectory; the sliding direction is determined according to the average direction.
  • the processor 112 when the processor 112 performs an average direction of determining the sliding operation that has been performed according to the currently generated sliding trajectory, the following steps are specifically performed:
  • a plurality of sliding contacts are collected in an equal time interval according to the currently generated sliding track, or a plurality of sliding contacts are collected in an equidistantly spaced manner according to the currently generated sliding track.
  • the processor 112 may be a central processing unit (CPU), and the processor 112 may also be another general-purpose processor, a digital signal processor (DSP), Application Specific Integrated Circuit (ASIC), Field-Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware component, etc.
  • the general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
  • the embodiment of the present application further provides a computer readable storage medium, where the computer readable storage medium stores a computer program, where the computer program includes program instructions, and when the program instructions are executed, the following steps are implemented:
  • the sliding track calculates a sliding direction; adding a mutex to the same sliding event as the sliding direction; controlling the control to respond to a sliding event to which the mutex has been added; and if detecting the sliding operation ending, releasing the mutual Rebel lock.
  • the average direction of the sliding operation that has been performed is calculated based on the currently generated sliding trajectory; the sliding direction is determined based on the average direction.
  • the specific implementation is:
  • the processor 112 when the processor 112 performs a plurality of sliding contacts according to the currently generated sliding trajectory, the processor 112 performs:
  • a plurality of sliding contacts are collected in an equal time interval according to the currently generated sliding track, or a plurality of sliding contacts are collected in an equidistantly spaced manner according to the currently generated sliding track.
  • the specific implementation is:

Abstract

Provided by the embodiments of the present application are a method, device and equipment for preventing an interface from shaking, and a computer-readable storage medium, the method comprising: acquiring sliding time and a sliding track of a sliding operation if detected that multiple sliding events in different directions are triggered on a control due to the sliding operation; if the sliding time reaches a preset time and the sliding operation is not finished, calculating a sliding direction according to the current generated sliding track; adding a mutually exclusive lock to sliding events having the same sliding direction; controlling the control to respond to the sliding events having the mutually exclusive lock added thereto; and if detected that the sliding operation is finished, removing the mutually exclusive lock. According to the embodiments of the present application, sliding direction is calculated within the preset time, a mutually exclusive lock is added to sliding events having the same sliding direction so that the control only responds to the sliding of the sliding events which have the mutually exclusive lock added thereto, thereby preventing a terminal interface from shaking due to multiple sliding events in different directions which are triggered by the sliding operation.

Description

防止界面抖动的方法、装置、设备及计算机可读存储介质Method, device, device and computer readable storage medium for preventing interface jitter
本申请要求于2017年11月8日提交中国专利局、申请号为201711092114.3、发明名称为“防止界面抖动的方法、装置、设备及计算机可读存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese Patent Application filed on November 8, 2017, the Chinese Patent Office, Application No. 201711092114.3, entitled "Method, Apparatus, Apparatus, and Computer Readable Storage Medium for Preventing Interface Jitter", all of which The content is incorporated herein by reference.
技术领域Technical field
本申请涉及信息处理技术领域,尤其涉及一种防止界面抖动的方法、装置、设备及计算机可读存储介质。The present application relates to the field of information processing technologies, and in particular, to a method, an apparatus, a device, and a computer readable storage medium for preventing interface jitter.
背景技术Background technique
用户在操作终端上的控件时经常会遇到终端界面抖动的问题,如显示网页内容的webview控件,该控件的某些区域可以同时触发上下滑动和左右滑动的效果。如webview控件本身在显示页面时具有上下滑动的效果,webview控件当做是一个容器时,它内部还有其他的一些标签,如显示图片的标签,该显示图片的标签具有左右滑动的效果。如用javascript代码生成的多张图片轮播,该轮播的图片具有左右滑动的效果。用户的动作是随机的,如果在较短的时间内,用户的手指上下左右滑动,终端界面就会出现抖动的问题。如用户的手指放在轮播的图片上,斜着滑动,图片标签触发了其对应的滑动事件,该滑动事件可以实现左右滑动的效果,而webview控件的本身也触发了其对应的滑动事件,该滑动事件可以实现上下滑动的效果,那么就会检测到既有左右滑动又有上下滑动,终端就会出现抖动,影响了用户的体验。Users often encounter terminal interface jitter when operating the controls on the terminal, such as the webview control that displays the content of the webpage. Some areas of the control can trigger the effect of sliding up and down and sliding left and right at the same time. For example, the webview control itself has the effect of sliding up and down when displaying the page. When the webview control is a container, there are other tags inside it, such as a label for displaying the image, and the label of the displayed image has the effect of sliding left and right. For example, if multiple images are generated by javascript code, the image of the carousel has the effect of sliding left and right. The user's actions are random. If the user's finger slides up and down and left and right in a short period of time, the terminal interface will experience jitter. If the user's finger is placed on the carousel image, it slides obliquely, and the picture tag triggers its corresponding sliding event. The sliding event can achieve the left and right sliding effect, and the webview control itself triggers its corresponding sliding event. The sliding event can achieve the effect of sliding up and down, then it will detect that both the left and right sliding and the vertical sliding, the terminal will appear jitter, affecting the user experience.
发明内容Summary of the invention
本申请实施例提供了一种防止界面抖动的方法、装置、设备及计算机可读存储介质,可以在控件同时存在多个滑动事件时,防止多个滑动事件引起的终端界面的抖动。The embodiments of the present invention provide a method, an apparatus, a device, and a computer readable storage medium for preventing interface jitter, which can prevent jitter of a terminal interface caused by multiple sliding events when multiple sliding events exist simultaneously in the control.
第一方面,本申请实施例提供了一种防止界面抖动的方法,该方法包括:In a first aspect, an embodiment of the present application provides a method for preventing interface jitter, where the method includes:
若检测到控件上因滑动操作而触发多个不同方向上的滑动事件,获取所述滑动操作的滑动时间和滑动轨迹;If it is detected that a sliding event in a plurality of different directions is triggered by the sliding operation on the control, the sliding time and the sliding track of the sliding operation are acquired;
若所述滑动时间达到预设时间且所述滑动操作未结束,根据当前已产生的滑动轨迹计算滑动方向;If the sliding time reaches a preset time and the sliding operation is not completed, the sliding direction is calculated according to the currently generated sliding track;
对与所述滑动方向相同的滑动事件加上互斥锁;Adding a mutex lock to the same sliding event as the sliding direction;
将加上互斥锁的滑动事件的滑动方向作为所述滑动操作的方向并上报给所述控件,以使所述控件响应当前滑动操作;The sliding direction of the sliding event of the mutex is added as the direction of the sliding operation and reported to the control, so that the control responds to the current sliding operation;
若所述滑动操作结束,解除所述互斥锁。If the sliding operation ends, the mutex is released.
第二方面,本申请实施例提供了一种防止界面抖动的装置,该装置包括用于执行上述第一方面所述的防止界面抖动的方法的单元。In a second aspect, an embodiment of the present application provides an apparatus for preventing interface jitter, the apparatus comprising means for performing the method for preventing interface jitter described in the first aspect above.
第三方面,本申请实施例还提供了一种计算机设备,所述计算机设备包括存储器,以及与所述存储器相连的处理器;In a third aspect, the embodiment of the present application further provides a computer device, where the computer device includes a memory, and a processor connected to the memory;
所述存储器用于存储实现防止界面抖动的计算机程序,所述处理器用于运行所述存储器中存储的计算机程序,以执行上述第一方面所述的防止界面抖动的方法。The memory is for storing a computer program that implements prevention of interface jitter, the processor for running a computer program stored in the memory to perform the method of preventing interface jitter described in the first aspect above.
第四方面,本申请实施例提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序包括程序指令,所述程序指令被处理器执行时,实现上述第一方面所述的防止界面抖动的方法。In a fourth aspect, an embodiment of the present application provides a computer readable storage medium, where the computer readable storage medium stores a computer program, where the computer program includes program instructions, and when the program instructions are executed by a processor, implementing the foregoing The method of preventing interface jitter described in the first aspect.
本申请实施例通过若检测到控件上因滑动操作而触发的多个滑动事件时,获取所述滑动操作的滑动时间和滑动轨迹;若所述滑动时间达到预设时间且所述滑动操作未结束,根据当前已产生的滑动轨迹计算滑动方向;对与所述滑动方向相同的滑动事件加上互斥锁;控制所述控件响应已加上互斥锁的滑动事件;若所述滑动操作结束,解除所述互斥锁。本申请实施例通过计算在预设时间内的滑动方向,并为所述滑动方向相同的滑动事件加上互斥锁,使所述控件只响应加上互斥锁的滑动事件的滑动,如此避免了因滑动操作而触发的多个不同方向上滑动事件引起的终端界面的抖动。In the embodiment of the present application, when a plurality of sliding events triggered by the sliding operation on the control are detected, the sliding time and the sliding track of the sliding operation are acquired; if the sliding time reaches a preset time and the sliding operation is not ended Calculating a sliding direction according to the currently generated sliding track; adding a mutex to the same sliding event as the sliding direction; controlling the control to respond to the sliding event with the mutex added; if the sliding operation ends, Release the mutex. In the embodiment of the present application, by calculating a sliding direction within a preset time and adding a mutex to the sliding event with the same sliding direction, the control only responds to the sliding of the sliding event with the mutex, thus avoiding The jitter of the terminal interface caused by a plurality of sliding events in different directions triggered by the sliding operation.
附图说明DRAWINGS
图1是本申请实施例提供的一种防止界面抖动的方法的流程示意图;1 is a schematic flowchart of a method for preventing interface jitter provided by an embodiment of the present application;
图2是本申请实施例提供的一种防止界面抖动的方法的子流程示意图;2 is a schematic diagram of a sub-flow of a method for preventing interface jitter provided by an embodiment of the present application;
图3是图2所示方法的子流程示意图;Figure 3 is a schematic diagram of a sub-flow of the method shown in Figure 2;
图4是本申请实施例提供的一种防止界面抖动的方法的子流程示意图;4 is a schematic diagram of a sub-flow of a method for preventing interface jitter provided by an embodiment of the present application;
图5是本申请另一实施例提供的一种防止界面抖动的方法的子流程示意图;FIG. 5 is a schematic diagram of a sub-flow of a method for preventing interface jitter according to another embodiment of the present application; FIG.
图6是本申请实施例提供的一种防止界面抖动的装置的示意性框图;6 is a schematic block diagram of an apparatus for preventing interface jitter provided by an embodiment of the present application;
图7是本申请实施例提供的计算单元的示意性框图;FIG. 7 is a schematic block diagram of a computing unit provided by an embodiment of the present application; FIG.
图8是本申请实施例提供的平均方向计算单元的示意性框图;8 is a schematic block diagram of an average direction calculation unit provided by an embodiment of the present application;
图9是本申请实施例提供的加锁单元的示意性框图;9 is a schematic block diagram of a locking unit provided by an embodiment of the present application;
图10是本申请另一实施例提供的计算单元的示意性框图;FIG. 10 is a schematic block diagram of a computing unit provided by another embodiment of the present application; FIG.
图11是本申请实施例提供的一种计算机设备的示意性框图。FIG. 11 is a schematic block diagram of a computer device according to an embodiment of the present application.
具体实施方式Detailed ways
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The technical solutions in the embodiments of the present application are clearly and completely described in the following with reference to the drawings in the embodiments of the present application. It is obvious that the described embodiments are a part of the embodiments of the present application, and not all of the embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments of the present application without departing from the inventive scope are the scope of the present application.
应当理解,尽管术语第一、第二等可以在此用来描述各种元素,但这些元素不应该受限于这些术语。这些术语仅用来将这些元素彼此区分开。例如,在不脱离本申请范围的前提下,第一夹角可以被称为第二夹角,并且类似地,第二夹角可以被称为第一夹角。第一夹角和第二夹角均为夹角,但他们并非同一夹角。It should be understood that although the terms first, second, etc. may be used herein to describe various elements, these elements should not be limited to these terms. These terms are only used to distinguish these elements from each other. For example, the first included angle may be referred to as a second included angle without departing from the scope of the present application, and similarly, the second included angle may be referred to as a first included angle. The first angle and the second angle are both included, but they are not the same angle.
图1是本申请实施例提供的一种防止界面抖动的方法的流程示意图。该方法运行于安装有控件的终端中,该控件具有上下左右的滑动效果。如图1所示,该方法包括S101-S105。1 is a schematic flow chart of a method for preventing interface jitter provided by an embodiment of the present application. The method runs in a terminal with a control installed, and the control has a sliding effect of up, down, left, and right. As shown in FIG. 1, the method includes S101-S105.
S101,若检测到控件上因滑动操作而触发的多个滑动事件,获取该滑动操作的滑动时间和滑动轨迹。S101. If multiple sliding events triggered by the sliding operation on the control are detected, the sliding time and the sliding track of the sliding operation are acquired.
如在显示网页内容的webview控件中,webview控件本身在显示页面时具 有上下滑动的效果,webview控件当做是一个容器时,它内部还有其他的一些标签,如显示轮播图片的标签,该轮播的图片具有左右滑动的效果。如若用户的手指放在轮播的图片上,斜着滑动,图片标签触发了其对应的滑动事件,该滑动事件可以实现左右滑动的效果,而webview控件本身也触发了其对应的滑动事件,该滑动事件可以实现上下滑动的效果,那么就会同时检测到两个滑动事件:图片标签对应的滑动事件和webview控件本身对应的滑动事件。需要注意的是,这里的同时并不是终端上的CPU认为的真正意义上的同时。事实上,检测到控件上的两个滑动事件的时间是有先后的,但是这个先后的时间间隔非常非常短,CPU可以忽略。For example, in the webview control that displays the content of the webpage, the webview control itself has the effect of sliding up and down when displaying the page. When the webview control is a container, there are other tags inside it, such as a label showing the carousel image, the round The broadcasted image has the effect of sliding left and right. If the user's finger is placed on the carousel image and slides obliquely, the picture tag triggers its corresponding sliding event, and the sliding event can achieve the left and right sliding effect, and the webview control itself also triggers its corresponding sliding event. The sliding event can achieve the effect of sliding up and down, then two sliding events will be detected at the same time: the sliding event corresponding to the image tag and the sliding event corresponding to the webview control itself. It should be noted that this is not the true meaning of the CPU on the terminal at the same time. In fact, the time to detect two sliding events on the control is sequential, but the time interval is very short and the CPU can ignore it.
若检测到控件上因滑动操作而触发的多个滑动事件,获取该滑动操作的滑动时间和滑动轨迹。如用户手指斜着滑动,那么获取该斜着滑动对应的滑动操作的滑动时间和滑动轨迹。其中,滑动时间是以检测到同时存在多个滑动事件时开始,到当前时间为止,对应的滑动操作持续的时间;滑动轨迹对应的是滑动时间内滑动的轨迹,其中,滑动轨迹包括滑动触点。滑动触点指的是在滑动操作过程中,可以识别的与终端接触的点,通常一个滑动轨迹包括多个滑动触点。本申请实施例中,滑动操作还可以包括有多个,如用户两只手同时滑动而引起的对应的滑动操作,用户两只手操作的区域属于控件中可以触发多个滑动事件的区域。若滑动操作有多个,如两个手指对应的滑动操作,那么获取对应的滑动时间,并分别获取对应的滑动时间内每个手指对应的滑动操作的滑动轨迹。If a plurality of sliding events triggered by the sliding operation on the control are detected, the sliding time and the sliding track of the sliding operation are obtained. If the user's finger slides obliquely, the sliding time and the sliding trajectory of the sliding operation corresponding to the oblique sliding are obtained. The sliding time is a time when the sliding event is detected when the plurality of sliding events exist at the same time, and the corresponding sliding operation continues until the current time; the sliding track corresponds to the sliding track during the sliding time, wherein the sliding track includes the sliding contact . A sliding contact refers to a point that can be identified in contact with the terminal during a sliding operation, typically a sliding track comprising a plurality of sliding contacts. In the embodiment of the present application, the sliding operation may further include a plurality of corresponding sliding operations caused by the simultaneous sliding of the two hands of the user, and the area operated by the two hands of the user belongs to an area in the control that can trigger multiple sliding events. If there are multiple sliding operations, such as sliding operations corresponding to two fingers, the corresponding sliding time is acquired, and the sliding trajectories of the sliding operations corresponding to each finger in the corresponding sliding time are respectively acquired.
S102,若滑动时间达到预设时间且滑动操作未结束,根据当前已产生的滑动轨迹计算滑动方向。S102. If the sliding time reaches the preset time and the sliding operation is not completed, the sliding direction is calculated according to the currently generated sliding track.
其中,预设时间可以为200ms。若滑动时间达到预设时间且滑动操作未结束,如检测到用户的手指未离开控件所在的区域,根据当前已产生的滑动轨迹计算滑动方向;否则,不响应该滑动操作。即滑动时间达到预设时间时滑动操作已结束,如滑动时间达到预设时间检测到用户的手指就离开控件所在的区域,以及滑动时间未达到预设时间而滑动操作已结束,如滑动的时间未达到预设时间检测到用户的手指就离开控件所在的区域,不响应该滑动操作。The preset time can be 200ms. If the sliding time reaches the preset time and the sliding operation is not finished, if it is detected that the user's finger does not leave the area where the control is located, the sliding direction is calculated according to the currently generated sliding track; otherwise, the sliding operation is not responded. That is, when the sliding time reaches the preset time, the sliding operation has ended. If the sliding time reaches the preset time, the user's finger is detected to leave the area where the control is located, and the sliding time has not reached the preset time and the sliding operation has ended, such as the sliding time. If the user's finger is detected when the preset time is not reached, the area where the control is located does not respond to the sliding operation.
具体地,如图2所示,根据当前已产生的滑动轨迹计算滑动方向,即步骤 S102包括S201-S202。Specifically, as shown in Fig. 2, the sliding direction is calculated based on the currently generated sliding trajectory, i.e., step S102 includes S201-S202.
S201,根据当前已产生的滑动轨迹计算已进行的滑动操作的平均方向。其中,已产生的滑动轨迹可理解为达到预设时间时,滑动操作产生的滑动轨迹。假设有以终端屏幕向右滑动为x轴正方向,屏幕向上滑动为y轴正方向,屏幕左下角为坐标原点的坐标轴,其中,预设轴为x轴,预设轴的方向为x轴正方向。S201. Calculate an average direction of the sliding operation that has been performed according to the currently generated sliding track. Among them, the generated sliding track can be understood as the sliding track generated by the sliding operation when the preset time is reached. Suppose that the terminal screen slides to the right as the positive direction of the x-axis, the screen slides up to the positive direction of the y-axis, and the lower left corner of the screen is the coordinate axis of the origin of the coordinate, wherein the preset axis is the x-axis and the direction of the preset axis is the x-axis. Positive direction.
如图3所示,根据当前已产生的滑动轨迹计算已进行的滑动操作的平均方向,即步骤S201包括S301-S304。As shown in FIG. 3, the average direction of the sliding operation that has been performed is calculated based on the currently generated sliding trajectory, that is, step S201 includes S301-S304.
S301,根据当前已产生的滑动轨迹采集多个滑动触点。可选地,可以根据当前已产生的滑动轨迹按照等时间间隔的方式采集多个滑动触点,也可以根据当前已产生的滑动轨迹按照等距离间隔的方式采集多个滑动触点。等距离间隔可以是在预设轴x轴方向上的相等距离间隔,也可以是在y轴方向上的相等距离间隔。其中,多个滑动触点可以是50个滑动触点。S301. Acquire a plurality of sliding contacts according to the currently generated sliding track. Optionally, a plurality of sliding contacts may be collected in an equal time interval according to the currently generated sliding track, or a plurality of sliding contacts may be collected in an equidistantly spaced manner according to the currently generated sliding track. The equidistant intervals may be equal distance intervals in the x-axis direction of the preset axis, or may be equal distance intervals in the y-axis direction. Among them, the plurality of sliding contacts may be 50 sliding contacts.
S302,确定相邻两个滑动触点的连线与预设轴的夹角。其中,在本实施例中,预设轴为x轴,预设轴的方向为x轴正方向。相邻两个滑动触点指的是同一个滑动操作产生的滑动轨迹上的相邻滑动触点。在其他实施例中,预设轴可以为x轴,方向为x轴负方向;预设轴也可以是y轴,方向为y轴正方向或者y轴负方向。对于所有采集的滑动触点,将相邻两个滑动触点连线,并计算该连线与预设轴的夹角,具体地,获取两个滑动触点的x、y坐标,根据x、y坐标计算与预设轴的夹角,如计算出来的夹角为48度,具体的度数可以直接四舍五入到整数。若采集有50个滑动触点,那么就可以计算出49个夹角。S302. Determine an angle between a line connecting two adjacent sliding contacts and a preset axis. Wherein, in the embodiment, the preset axis is the x-axis, and the direction of the preset axis is the positive direction of the x-axis. Adjacent two sliding contacts refer to adjacent sliding contacts on the sliding track produced by the same sliding operation. In other embodiments, the preset axis may be the x-axis and the direction is the x-axis negative direction; the preset axis may also be the y-axis, and the direction is the positive direction of the y-axis or the negative direction of the y-axis. For all the collected sliding contacts, connect the adjacent two sliding contacts, and calculate the angle between the connecting line and the preset axis. Specifically, obtain the x and y coordinates of the two sliding contacts, according to x, The y coordinate calculates the angle with the preset axis. If the calculated angle is 48 degrees, the specific degree can be directly rounded to the whole number. If you have 50 sliding contacts, you can calculate 49 angles.
S303,计算已确定的所有夹角的平均值。即将所有的夹角的值相加,除以夹角的个数,如3个夹角的值分别为50度、60度、42度,那么该3个夹角的平均值为(50+60+42)/3=50度。S303. Calculate an average value of all the angles that have been determined. Add the values of all the angles and divide by the number of angles. If the values of the three angles are 50 degrees, 60 degrees, and 42 degrees, then the average of the three angles is (50+60). +42) / 3 = 50 degrees.
S304,根据所有夹角的平均值和预设轴的方向确定已进行的滑动操作的平均方向。具体地,若所有夹角的平均值范围在315度至45度之间,已进行的滑动操作的平均方向与预设轴的方向(x轴正方向)相同;若所有夹角的平均值范围在135度至225度之间,已进行的滑动操作的平均方向与预设轴的方向(x轴正方向)相反;否则,滑动方向在预设轴的垂直方向上。其中,若所有夹角 的平均值范围在45度至135度之间,已进行的滑动操作的平均方向与y轴正方向相同;若所有夹角的平均值范围在225度至315度,已进行的滑动操作的平均方向与y轴正方向相反。S304, determining an average direction of the sliding operation that has been performed according to an average value of all the included angles and a direction of the preset axis. Specifically, if the average value of all the included angles is between 315 degrees and 45 degrees, the average direction of the sliding operation that has been performed is the same as the direction of the preset axis (the positive direction of the x-axis); if the average range of all the included angles Between 135 and 225 degrees, the average direction of the sliding operation that has been performed is opposite to the direction of the preset axis (the positive x-axis direction); otherwise, the sliding direction is in the vertical direction of the preset axis. Wherein, if the average of all the angles ranges from 45 degrees to 135 degrees, the average direction of the sliding operation that has been performed is the same as the positive direction of the y-axis; if the average of all the angles ranges from 225 degrees to 315 degrees, The average direction of the sliding operation performed is opposite to the positive direction of the y-axis.
S202,根据该平均方向确定已进行的滑动操作的滑动方向。若已进行的滑动操作的平均方向与预设轴的方向(x轴正方向)相同,确定已进行的滑动操作的滑动方向为向右滑动;若已进行的滑动操作的平均方向与预设轴的方向(x轴正方向)相反,即已进行的滑动操作的滑动方向为向左滑动;若已进行的滑动操作的平均方向与y轴正方向相同,即已进行的滑动操作的滑动方向为向上滑动;若已进行的滑动操作的平均方向与y轴正方向相反,即已进行的滑动操作的滑动方向为向下滑动。S202. Determine a sliding direction of the sliding operation that has been performed according to the average direction. If the average direction of the sliding operation has been the same as the direction of the preset axis (the positive direction of the x-axis), it is determined that the sliding direction of the sliding operation that has been performed is sliding to the right; if the average direction of the sliding operation has been performed with the preset axis The direction of the x-axis positive direction is opposite, that is, the sliding direction of the sliding operation that has been performed is sliding to the left; if the average direction of the sliding operation that has been performed is the same as the positive direction of the y-axis, that is, the sliding direction of the sliding operation that has been performed is Sliding upward; if the average direction of the sliding operation that has been performed is opposite to the positive direction of the y-axis, that is, the sliding direction of the sliding operation that has been performed is sliding downward.
若检测到的滑动操作只有一个,根据该一个滑动操作当前已产生的滑动轨迹计算已进行的滑动操作的平均方向,根据该平均方向确定在预设时间内已进行的滑动操作的滑动方向。若检测到的滑动操作对应有多个,如两个滑动操作,分别采集两个滑动操作当前已产生的滑动轨迹上的多个滑动触点,再确定每一个滑动轨迹上相邻两个滑动触点的连线与预设轴的夹角,以及计算每一个滑动轨迹上已确定的所有夹角的平均值,得到两个平均值,分别称为第一平均值和第二平均值。如第一平均值为42度,第二平均值为60度。将第一平均值和第二平均值进行平均,如平均后的角度为(42度+60度)/2=51度,再根据平均后的角度以及预设轴的方向确定已进行的滑动操作的平均方向。那么,确定已进行的滑动操作的平均方向为y轴正方向,根据该平均方向确定已进行的滑动操作的滑动方向为向上滑动。If there is only one sliding operation detected, the average direction of the sliding operation that has been performed is calculated according to the sliding trajectory currently generated by the one sliding operation, and the sliding direction of the sliding operation that has been performed within the preset time is determined according to the average direction. If there are multiple sliding operations detected, such as two sliding operations, respectively, multiple sliding contacts on the sliding track currently generated by the two sliding operations are acquired, and then two adjacent sliding contacts on each sliding track are determined. The angle between the line of the point and the preset axis, and the average of all the angles determined on each of the sliding tracks are calculated to obtain two average values, which are referred to as a first average value and a second average value, respectively. For example, the first average is 42 degrees and the second average is 60 degrees. The first average value and the second average value are averaged, for example, the averaged angle is (42 degrees + 60 degrees) / 2 = 51 degrees, and then the sliding operation has been determined according to the averaged angle and the direction of the preset axis. The average direction. Then, it is determined that the average direction of the sliding operation that has been performed is the positive direction of the y-axis, and the sliding direction of the sliding operation that has been performed is determined to be the upward sliding according to the average direction.
S103,对与所述滑动方向相同的滑动事件加上互斥锁。S103, adding a mutex to the same sliding event as the sliding direction.
如若两个滑动事件的滑动方向分别是向右滑动、向上滑动,若根据当前已产生的滑动轨迹计算出的滑动方向为向上滑动,那么给向上滑动的滑动事件加上互斥锁。互斥锁也叫排它锁、独占锁等。若创建了互斥锁,控件同一时间只能响应一个滑动事件,如加上互斥锁的滑动事件一直会被响应,其他的滑动事件不被响应。If the sliding directions of the two sliding events are respectively sliding to the right and sliding upward, if the sliding direction calculated according to the currently generated sliding track is sliding upward, the sliding event of the upward sliding is added with a mutex. Mutexes are also called exclusive locks, exclusive locks, and so on. If a mutex is created, the control can only respond to a sliding event at the same time. For example, a sliding event with a mutex is always responded, and other sliding events are not responded.
具体地,如图4所示,对与所述滑动方向相同的滑动事件加上互斥锁,即步骤S103包括S401-S403。Specifically, as shown in FIG. 4, the same sliding event as the sliding direction is added with a mutex, that is, step S103 includes S401-S403.
S401,判断是否创建了控件的互斥锁。S401. Determine whether a mutex of the control is created.
S402,若没有创建控件的互斥锁,创建控件的互斥锁。控件的互斥锁可以是已经存在的,可以理解为,在执行本步骤之前就已经创建好了控件的互斥锁。假若控件的互斥锁不存在,那么需要创建控件的互斥锁,可以理解为,创建控件响应滑动事件的互斥锁。S402. If the mutex of the control is not created, create a mutex of the control. The mutex of the control can already exist. It can be understood that the mutex of the control has been created before the step is executed. If the control's mutex does not exist, you need to create a mutex of the control, which can be understood as creating a mutex that controls the response to the sliding event.
S403,对与所述滑动方向相同的滑动事件加上创建的互斥锁。可以理解地,与所述滑动方向相同的滑动事件会被一直响应。而在加上互斥锁之前的预设时间内,不响应滑动操作。S403: Add the created mutex to the same sliding event as the sliding direction. It can be understood that the same sliding event as the sliding direction is always responded. The sliding operation is not responded to within the preset time before the mutex is added.
上述根据当前已产生的滑动轨迹计算滑动方向,以及对与所述滑动方向相同的滑动事件加上互斥锁,是在滑动时间达到预设时间且滑动操作未结束的条件下完成的。The above calculation of the sliding direction based on the currently generated sliding trajectory and the addition of the mutex to the same sliding event as the sliding direction are performed under the condition that the sliding time reaches the preset time and the sliding operation is not completed.
S104,控制控件响应已加上互斥锁的滑动事件。若滑动操作未结束,控制控件只响应加上互斥锁的滑动事件。如若加上互斥锁的滑动事件的滑动方向在加上互斥锁之前向上滑动,加上互斥锁之后仍然向上滑动,那么对应将向上滑动的滑动方向上报给控件,以使控件响应该滑动事件的向上滑动。若加上互斥锁的滑动事件的滑动方向在加上互斥锁之前向上滑动,加上互斥锁之后的一段时间内向下滑动,那么对应将该时间内的向下滑动的滑动方向上报给控件,以使控件响应该滑动事件的向下滑动。如此,可以提高控件响应滑动事件的准确性。S104. The control control responds to the sliding event with the mutex added. If the swipe operation is not over, the control control only responds to the sliding event with the mutex added. If the sliding direction of the mutex with the mutex is swiped up before the mutex is added, and the mutex is still swiped up after the mutex is locked, the sliding direction corresponding to the upward sliding is reported to the control, so that the control responds to the sliding The event slides up. If the sliding direction of the sliding event of the mutex is swiped up before the mutex is added, and sliding down after a period of time after the mutex is applied, the sliding direction corresponding to the downward sliding in the time is reported to Controls to make the control slide down in response to the sliding event. In this way, the accuracy of the control's response to the sliding event can be improved.
S105,若检测到滑动操作结束,解除所述互斥锁。其中,解除可理解为释放或者销毁。若有多个滑动操作,如两个滑动操作,滑动操作结束,可理解为,两个滑动操作都已结束,或者其中一个滑动操作结束。其中一个滑动操作结束,视为滑动操作结束,可以理解为,若只有一个滑动操作了,控件只需响应该滑动操作的滑动事件即可,不存在多个滑动事件的情况,也就不存在抖动的情况了。S105. If it is detected that the sliding operation ends, the mutex is released. Among them, the release can be understood as release or destruction. If there are multiple sliding operations, such as two sliding operations, the sliding operation ends, it can be understood that both sliding operations have ended, or one of the sliding operations ends. One of the sliding operations ends, which is regarded as the end of the sliding operation. It can be understood that if there is only one sliding operation, the control only needs to respond to the sliding event of the sliding operation. There are no multiple sliding events, and there is no jitter. The situation is gone.
上述实施例通通过若检测到控件上因滑动操作而触发的多个滑动事件时,获取所述滑动操作的滑动时间和滑动轨迹;若所述滑动时间达到预设时间且所述滑动操作未结束,根据当前已产生的滑动轨迹计算滑动方向;对与所述滑动方向相同的滑动事件加上互斥锁;控制控件响应已加上互斥锁的滑动事件;若 所述滑动操作结束,解除所述互斥锁。本申请实施例通过计算在预设时间内的滑动方向,并为所述滑动方向相同的滑动事件加上互斥锁,使所述控件只响应加上互斥锁的滑动事件的滑动,如此避免了因滑动操作而触发的多个滑动事件引起的终端界面的抖动。The above embodiment obtains the sliding time and the sliding track of the sliding operation when detecting a plurality of sliding events triggered by the sliding operation on the control; if the sliding time reaches the preset time and the sliding operation is not ended Calculating the sliding direction according to the currently generated sliding track; adding a mutex to the same sliding event as the sliding direction; the control control responds to the sliding event with the mutex added; if the sliding operation ends, the lifting The mutex is described. In the embodiment of the present application, by calculating a sliding direction within a preset time and adding a mutex to the sliding event with the same sliding direction, the control only responds to the sliding of the sliding event with the mutex, thus avoiding The jitter of the terminal interface caused by multiple sliding events triggered by the sliding operation.
在其他实施例中,对与所述滑动方向相同的滑动事件加上互斥锁后,将根据当前已产生的滑动轨迹计算出的滑动方向,作为加上互斥锁的滑动事件的滑动方向,并控制控件响应该滑动方向。可以理解为,在对与所述滑动方向相同的滑动事件加上互斥锁后且滑动操作未结束的时间内,可以根据当前已产生的滑动轨迹计算出的滑动方向,作为加上互斥锁的滑动事件的滑动方向。在滑动事件持有互斥锁的时间内,无论检测到滑动操作的时间有多久,就只根据当前已产生的滑动轨迹计算出的滑动方向,作为加上互斥锁的滑动事件的滑动方向,向该控件上报该滑动方向,以使控件响应该加上互斥锁的滑动事件。如此,就无需在滑动事件加上互斥锁后,获取对应的滑动操作的滑动触点以及计算滑动操作的滑动方向,节省了计算量、存储量,同时也节省了终端的电量。In other embodiments, after adding a mutex to the same sliding event as the sliding direction, the sliding direction calculated according to the currently generated sliding trajectory is used as the sliding direction of the sliding event of the mutex. And control the control to respond to the sliding direction. It can be understood that, in the time when the same sliding event is added to the sliding event and the sliding operation is not completed, the sliding direction calculated according to the currently generated sliding trajectory can be used as the mutex added. The sliding direction of the sliding event. In the time when the sliding event holds the mutex, no matter how long the sliding operation is detected, the sliding direction calculated only according to the currently generated sliding trajectory is used as the sliding direction of the sliding event of the mutex. Report the sliding direction to the control so that the control responds to the sliding event with the mutex added. In this way, it is not necessary to obtain the sliding contact of the corresponding sliding operation and calculate the sliding direction of the sliding operation after the sliding event is added with the mutex, which saves the calculation amount and the storage amount, and also saves the power of the terminal.
图5是本申请实施例提供的一种防止界面抖动的方法的子流程示意图。如图5所示,根据当前已产生的滑动轨迹计算滑动方向,包括S501-S502。FIG. 5 is a schematic diagram of a sub-flow of a method for preventing interface jitter provided by an embodiment of the present application. As shown in FIG. 5, the sliding direction is calculated based on the currently generated sliding trajectory, including S501-S502.
S501,根据当前已产生的滑动轨迹获取滑动轨迹开始时的第一触点和到达预设时间时的第二触点。具体地,获取第一触点和第二触点的坐标。若滑动操作只有一个,获取该滑动操作在滑动开始时的第一触点的坐标和到达预设时间时的第二触点的坐标。若滑动操作有多个,如两个滑动操作,分别获取两个滑动操作在滑动开始时的第一触点的坐标和到达预设时间时的第二触点的坐标。S501. Acquire a first contact at the start of the sliding track and a second contact when the preset time is reached according to the currently generated sliding track. Specifically, the coordinates of the first contact and the second contact are acquired. If there is only one sliding operation, the coordinates of the first contact at the start of the sliding operation and the coordinates of the second contact when the preset time is reached are acquired. If there are multiple sliding operations, such as two sliding operations, the coordinates of the first contact of the two sliding operations at the start of the sliding and the coordinates of the second contact when the preset time is reached are respectively acquired.
S502,根据第一触点和第二触点确定滑动操作的滑动方向。其中,根据第一触点和第二触点确定滑动操作的滑动方向包括:根据第一触点和第二触点所在的直线的方向确定滑动操作的滑动方向。若滑动操作只有一个,将该滑动操作对应的第一触点与第二触点进行连线,并计算该连线与预设轴的夹角,根据该连线与预设轴的夹角以及预设轴的方向确定滑动方向。具体地,若该夹角范围在315度至45度之间,滑动方向与预设轴的方向相同,即确定滑动操作的滑动方向为向右滑动;若该夹角范围在135度至225度之间,滑动方向与预设轴的方向相反,即确定滑动操作的滑动方向为向左滑动;若该夹角范围在45至 135度之间,确定滑动操作的滑动方向与y轴正方向相同,即向上滑动;若该夹角范围在225度至315度之间,确定滑动操作的滑动方向与y轴正方向相反,即向下滑动。若有滑动操作多个,如两个滑动操作,先将其中一个滑动操作对应的第一触点与第二触点进行连线,并计算该连线与预设轴的夹角,称为第一夹角,如该第一夹角为42度。再将另外一个滑动操作对应的第一触点与第二触点进行连线,并计算该连线与预设轴的夹角,称为第二夹角,如该第二夹角为60度。最后将第一夹角和第二夹角进行平均后,根据平均后的夹角值与预设轴的方向确定滑动方向。如(42度+60度)/2=51度,那么确定滑动操作的滑动方向为y轴正方向,即向上滑动。S502. Determine a sliding direction of the sliding operation according to the first contact and the second contact. Wherein determining the sliding direction of the sliding operation according to the first contact and the second contact comprises: determining a sliding direction of the sliding operation according to a direction of a straight line where the first contact and the second contact are located. If there is only one sliding operation, the first contact corresponding to the sliding operation is connected with the second contact, and the angle between the connecting line and the preset axis is calculated, according to the angle between the connecting line and the preset axis, and The direction of the preset axis determines the direction of the slide. Specifically, if the angle ranges from 315 degrees to 45 degrees, the sliding direction is the same as the direction of the preset axis, that is, the sliding direction of the sliding operation is determined to slide to the right; if the angle ranges from 135 degrees to 225 degrees Between the sliding direction and the direction of the preset axis, that is, the sliding direction of the sliding operation is determined to be sliding to the left; if the angle is between 45 and 135 degrees, it is determined that the sliding direction of the sliding operation is the same as the positive direction of the y-axis , that is, sliding upward; if the angle is between 225 degrees and 315 degrees, it is determined that the sliding direction of the sliding operation is opposite to the positive direction of the y-axis, that is, sliding downward. If there are multiple sliding operations, such as two sliding operations, the first contact corresponding to one sliding operation is first connected with the second contact, and the angle between the connecting line and the preset axis is calculated, which is called the first An angle, such as the first angle is 42 degrees. Then, the first contact corresponding to the other sliding operation is connected with the second contact, and the angle between the connection and the preset axis is calculated, which is called the second angle, and the second angle is 60 degrees. . Finally, after averaging the first angle and the second angle, the sliding direction is determined according to the averaged angle value and the direction of the preset axis. For example, (42 degrees + 60 degrees) / 2 = 51 degrees, then it is determined that the sliding direction of the sliding operation is the positive direction of the y-axis, that is, sliding upward.
该实施例通过获取在滑动开始时的第一触点和到达预设时间时的第二触点,计算第一触点和第二触点所在的直线的方向与预设轴的夹角,根据该夹角确定滑动操作的滑动方向。The embodiment calculates the angle between the direction of the straight line where the first contact and the second contact is located and the preset axis by acquiring the first contact at the start of the sliding and the second contact when the preset time is reached, according to This angle determines the sliding direction of the sliding operation.
在其他实施例中,根据第一触点和第二触点确定滑动操作的滑动方向包括:根据第一触点和第二触点所在的直线的矢量来确定滑动操作的滑动方向。如若只有一个滑动操作,根据第一触点和第二触点所在的直线的矢量计算在坐标轴上的不同方向上的分量。如若在x轴上的分量大于在y轴上的分量,且矢量的方向向右,那么确定已进行的滑动操作的滑动方向为向右,若在y轴上的分量大于在x轴上的分量,且矢量的方向向上,那么确定已进行的滑动操作的滑动方向为向上等。In other embodiments, determining the sliding direction of the sliding operation based on the first contact and the second contact comprises determining a sliding direction of the sliding operation based on a vector of straight lines in which the first contact and the second contact are located. If there is only one sliding operation, the components in different directions on the coordinate axis are calculated from the vectors of the straight lines in which the first contact and the second contact are located. If the component on the x-axis is larger than the component on the y-axis and the direction of the vector is to the right, then the sliding direction of the sliding operation that has been performed is determined to be rightward, if the component on the y-axis is larger than the component on the x-axis. And the direction of the vector is upward, then it is determined that the sliding direction of the sliding operation that has been performed is upward.
以上实施例中,若计算出的夹角正好为45度、135度、225度、315度,这些夹角对应时间点上滑动操作的滑动方向根据预设规则来决定。如根据前一时刻(或者前N个时刻)滑动操作的滑动方向决定或者随机选取一个方向决定。若根据前一时刻(或者前N个时刻)滑动操作的滑动方向决定,那么前一时刻(或者前N个时刻)滑动操作的滑动方向为向上滑动,那么这些夹角对应时间点上滑动操作的滑动方向向上。In the above embodiment, if the calculated angles are exactly 45 degrees, 135 degrees, 225 degrees, and 315 degrees, the sliding directions of the sliding operations corresponding to the angles are determined according to a preset rule. For example, it is determined according to the sliding direction of the sliding operation at the previous moment (or the first N moments) or a direction is randomly selected. If the sliding direction of the sliding operation is determined according to the previous moment (or the first N moments), then the sliding direction of the sliding operation at the previous moment (or the first N moments) is the upward sliding, then the angles corresponding to the sliding operation at the time point The sliding direction is upward.
图6是本申请实施例提供的一种防止界面抖动的装置的示意性框图。该装置60包括获取单元601、计算单元602、加锁单元603、控制单元604、解除锁单元605。FIG. 6 is a schematic block diagram of an apparatus for preventing interface jitter provided by an embodiment of the present application. The device 60 includes an acquisition unit 601, a calculation unit 602, a lock unit 603, a control unit 604, and an unlock unit 605.
获取单元601用于若检测到控件上因滑动操作而触发的多个滑动事件,获 取该滑动操作的滑动时间和滑动轨迹。The obtaining unit 601 is configured to obtain a sliding time and a sliding track of the sliding operation if a plurality of sliding events triggered by the sliding operation on the control are detected.
计算单元602用于若滑动时间达到预设时间且滑动操作未结束,根据当前已产生的滑动轨迹计算滑动方向。The calculating unit 602 is configured to calculate the sliding direction according to the currently generated sliding track if the sliding time reaches the preset time and the sliding operation is not ended.
具体地,如图7所示,计算单元602包括平均方向计算单元701、第一确定单元702。该计算单元602用于根据当前已产生的滑动轨迹计算滑动方向。Specifically, as shown in FIG. 7, the calculation unit 602 includes an average direction calculation unit 701 and a first determination unit 702. The calculating unit 602 is configured to calculate a sliding direction according to the currently generated sliding trajectory.
其中,平均方向计算单元701用于根据当前已产生的滑动轨迹计算已进行的滑动操作的平均方向。如图8所示,平均方向计算单元701包括采集单元801、夹角确定单元802、平均夹角计算单元803、平均方向确定单元804。采集单元801用于根据当前已产生的滑动轨迹采集多个滑动触点。可选地,可以根据当前已产生的滑动轨迹按照等时间间隔的方式采集多个滑动触点,也可以根据当前已产生的滑动轨迹按照等距离间隔的方式采集多个滑动触点。等距离间隔可以是在预设轴x轴方向上的相等距离间隔,也可以是在y轴方向上的相等距离间隔。夹角确定单元802用于确定相邻两个滑动触点的连线与预设轴的夹角。平均夹角计算单元803用于计算已确定的所有夹角的平均值。平均方向确定单元804根据所有夹角的平均值和预设轴的方向确定已进行的滑动操作的平均方向。第一确定单元702用于根据该平均方向确定已进行的滑动操作的滑动方向。The average direction calculation unit 701 is configured to calculate an average direction of the sliding operation that has been performed according to the currently generated sliding track. As shown in FIG. 8, the average direction calculation unit 701 includes an acquisition unit 801, an angle determination unit 802, an average angle calculation unit 803, and an average direction determination unit 804. The collecting unit 801 is configured to collect a plurality of sliding contacts according to the currently generated sliding track. Optionally, a plurality of sliding contacts may be collected in an equal time interval according to the currently generated sliding track, or a plurality of sliding contacts may be collected in an equidistantly spaced manner according to the currently generated sliding track. The equidistant intervals may be equal distance intervals in the x-axis direction of the preset axis, or may be equal distance intervals in the y-axis direction. The included angle determining unit 802 is configured to determine an angle between a line connecting two adjacent sliding contacts and a preset axis. The average angle calculation unit 803 is for calculating an average value of all the angles that have been determined. The average direction determining unit 804 determines the average direction of the sliding operation that has been performed based on the average value of all the included angles and the direction of the preset axis. The first determining unit 702 is configured to determine a sliding direction of the sliding operation that has been performed according to the average direction.
加锁单元603用于对与所述滑动方向相同的滑动事件加上互斥锁。如若两个滑动事件的滑动方向分别是向右滑动、向上滑动,若根据当前已产生的滑动轨迹计算出的滑动方向为向上滑动,那么给向上滑动的滑动事件加上互斥锁。互斥锁也叫排它锁、独占锁等。若创建了互斥锁,控件同一时间只能响应一个滑动事件,如加上互斥锁的滑动事件一直会被响应,其他的滑动事件不被响应。The locking unit 603 is configured to add a mutex to the same sliding event as the sliding direction. If the sliding directions of the two sliding events are respectively sliding to the right and sliding upward, if the sliding direction calculated according to the currently generated sliding track is sliding upward, the sliding event of the upward sliding is added with a mutex. Mutexes are also called exclusive locks, exclusive locks, and so on. If a mutex is created, the control can only respond to a sliding event at the same time. For example, a sliding event with a mutex is always responded, and other sliding events are not responded.
具体地,如图9所示,对与所述滑动方向相同的滑动事件加上互斥锁,即加锁单元603包括互斥锁判断单元901、互斥锁创建单元902、互斥锁添加单元903。互斥锁判断单元901用于判断是否创建了控件的互斥锁。互斥锁创建单元902用于若没有创建控件的互斥锁,创建控件的互斥锁。互斥锁添加单元903用于对与所述滑动方向相同的滑动事件加上获取的互斥锁。可以理解地,与所述滑动方向相同的滑动事件会被一直响应。而在加上互斥锁之前的预设时间内,不响应滑动操作。Specifically, as shown in FIG. 9, the same sliding event as the sliding direction is added with a mutex, that is, the locking unit 603 includes a mutex determining unit 901, a mutex creating unit 902, and a mutex adding unit. 903. The mutex lock determining unit 901 is configured to determine whether a mutex of the control is created. The mutex lock creating unit 902 is configured to create a mutex of the control if the mutex of the control is not created. The mutex lock adding unit 903 is configured to add the acquired mutex to the same sliding event as the sliding direction. It can be understood that the same sliding event as the sliding direction is always responded. The sliding operation is not responded to within the preset time before the mutex is added.
控制单元604用于控制控件响应已加上互斥锁的滑动事件。The control unit 604 is configured to control the control to respond to the sliding event to which the mutex has been added.
解除锁单元605用于若检测到滑动操作结束,解除所述互斥锁。The unlocking unit 605 is configured to release the mutex if it detects the end of the sliding operation.
在其他实施例中,在加锁单元对与所述滑动方向相同的滑动事件加上互斥锁后,控制单元将根据当前已产生的滑动轨迹计算出的滑动方向,作为加上互斥锁的滑动事件的滑动方向,并控制控件响应该滑动方向。In other embodiments, after the locking unit adds a mutex to the same sliding event as the sliding direction, the control unit calculates the sliding direction according to the currently generated sliding trajectory as a mutex plus The sliding direction of the sliding event and the control controls respond to the sliding direction.
图10是本申请另一实施例提供的计算单元602的示意性框图。该计算单元602用于根据当前已产生的滑动轨迹计算滑动方向。该计算单元602包括触点获取单元101、第二确定单元102。触点获取单元101用于根据当前已产生的滑动轨迹获取滑动轨迹开始时的第一触点和到达预设时间时的第二触点。第二确定单元102用于根据第一触点和第二触点确定滑动操作的滑动方向。FIG. 10 is a schematic block diagram of a computing unit 602 provided by another embodiment of the present application. The calculating unit 602 is configured to calculate a sliding direction according to the currently generated sliding trajectory. The calculation unit 602 includes a contact acquisition unit 101 and a second determination unit 102. The contact acquiring unit 101 is configured to acquire the first contact at the start of the sliding trajectory and the second contact when the preset time is reached according to the currently generated sliding trajectory. The second determining unit 102 is configured to determine a sliding direction of the sliding operation according to the first contact and the second contact.
在其他实施例中,根据第一触点和第二触点确定滑动操作的滑动方向包括:根据第一触点和第二触点所在的直线的矢量来确定滑动操作的滑动方向。如若只有一个滑动操作,根据第一触点和第二触点所在的直线的矢量计算在坐标轴上的不同方向上的分量。如若在x轴上的分量大于在y轴上的分量,且矢量的方向向右,那么确定已进行的滑动操作的滑动方向为向右,若在y轴上的分量大于在x轴上的分量,且矢量的方向向上,那么确定已进行的滑动操作的滑动方向为向上等。In other embodiments, determining the sliding direction of the sliding operation based on the first contact and the second contact comprises determining a sliding direction of the sliding operation based on a vector of straight lines in which the first contact and the second contact are located. If there is only one sliding operation, the components in different directions on the coordinate axis are calculated from the vectors of the straight lines in which the first contact and the second contact are located. If the component on the x-axis is larger than the component on the y-axis and the direction of the vector is to the right, then the sliding direction of the sliding operation that has been performed is determined to be rightward, if the component on the y-axis is larger than the component on the x-axis. And the direction of the vector is upward, then it is determined that the sliding direction of the sliding operation that has been performed is upward.
以上实施例中,若计算出的夹角正好为45度、135度、225度、315度,这些夹角对应时间点上滑动操作的滑动方向根据预设规则来决定。如根据前一时刻(或者前N个时刻)滑动操作的滑动方向决定或者随机选取一个方向决定。若根据前一时刻(或者前N个时刻)滑动操作的滑动方向决定,那么前一时刻(或者前N个时刻)滑动操作的滑动方向为向上滑动,那么这些夹角对应时间点上滑动操作的滑动方向向上。In the above embodiment, if the calculated angles are exactly 45 degrees, 135 degrees, 225 degrees, and 315 degrees, the sliding directions of the sliding operations corresponding to the angles are determined according to a preset rule. For example, it is determined according to the sliding direction of the sliding operation at the previous moment (or the first N moments) or a direction is randomly selected. If the sliding direction of the sliding operation is determined according to the previous moment (or the first N moments), then the sliding direction of the sliding operation at the previous moment (or the first N moments) is the upward sliding, then the angles corresponding to the sliding operation at the time point The sliding direction is upward.
上述描述的装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,达到的有益效果也可以参考前述方法实施例中达到的有益效果,在此不再赘述。For the specific working process of the device and the unit described above, refer to the corresponding process in the foregoing method embodiment, and the beneficial effects achieved can also be referred to the beneficial effects achieved in the foregoing method embodiments, and details are not described herein again.
上述防止界面抖动的装置可以实现为一种计算机程序的形式,该计算机程序可以在如图11所示的计算机设备上运行。The above described means for preventing interface jitter can be implemented in the form of a computer program that can be run on a computer device as shown in FIG.
图11为本申请实施例提供的一种计算机设备的示意性框图。该计算机设备110可以是终端。该计算机设备110包括通过系统总线111连接的处理器112、 存储器和网络接口113,其中,存储器可以包括非易失性存储介质114和内存储器115。FIG. 11 is a schematic block diagram of a computer device according to an embodiment of the present application. The computer device 110 can be a terminal. The computer device 110 includes a processor 112, a memory, and a network interface 113 that are coupled by a system bus 111, wherein the memory can include a non-volatile storage medium 114 and an internal memory 115.
该非易失性存储介质114可存储操作系统1141和计算机程序1142。该计算机程序1142被执行时,可使得处理器112执行一种防止界面抖动的方法。The non-volatile storage medium 114 can store an operating system 1141 and a computer program 1142. When the computer program 1142 is executed, the processor 112 can be caused to perform a method of preventing interface jitter.
该处理器112用于提供计算和控制能力,支撑整个计算机设备110的运行。The processor 112 is used to provide computing and control capabilities to support the operation of the entire computer device 110.
该内存储器115为非易失性存储介质中的计算机程序的运行提供环境,该计算机程序被处理器112执行时,可使得处理器112执行一种防止界面抖动的方法。The internal memory 115 provides an environment for the operation of a computer program in a non-volatile storage medium that, when executed by the processor 112, causes the processor 112 to perform a method of preventing interface jitter.
该网络接口113用于进行网络通信。本领域技术人员可以理解,图11中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备110的限定,具体的计算机设备110可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。The network interface 113 is used for network communication. It will be understood by those skilled in the art that the structure shown in FIG. 11 is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation of the computer device 110 to which the solution of the present application is applied, and a specific computer device. 110 may include more or fewer components than shown, or some components may be combined, or have different component arrangements.
其中,所述处理器112用于运行存储在存储器中的计算机程序,以实现如下步骤:The processor 112 is configured to run a computer program stored in the memory to implement the following steps:
若检测到控件上因滑动操作而触发的多个滑动事件,获取所述滑动操作的滑动时间和滑动轨迹;若所述滑动时间达到预设时间且所述滑动操作未结束,根据当前已产生的滑动轨迹计算滑动方向;对与所述滑动方向相同的滑动事件加上互斥锁;控制所述控件响应已加上互斥锁的滑动事件;若检测到所述滑动操作结束,解除所述互斥锁。If a plurality of sliding events triggered by the sliding operation on the control are detected, obtaining a sliding time and a sliding track of the sliding operation; if the sliding time reaches a preset time and the sliding operation is not ended, according to the currently generated The sliding track calculates a sliding direction; adding a mutex to the same sliding event as the sliding direction; controlling the control to respond to a sliding event to which the mutex has been added; and if detecting the sliding operation ending, releasing the mutual Rebel lock.
在一实施例中,处理器112执行根据当前已产生的滑动轨迹计算滑动方向时,具体执行如下步骤:In an embodiment, when the processor 112 performs the calculation of the sliding direction according to the currently generated sliding trajectory, the following steps are specifically performed:
根据当前已产生的滑动轨迹计算已进行的滑动操作的平均方向;根据所述平均方向确定所述滑动方向。The average direction of the sliding operation that has been performed is calculated based on the currently generated sliding trajectory; the sliding direction is determined according to the average direction.
在一实施例中,处理器112执行根据当前已产生的滑动轨迹确定已进行的滑动操作的平均方向时,具体执行如下步骤:In an embodiment, when the processor 112 performs an average direction of determining the sliding operation that has been performed according to the currently generated sliding trajectory, the following steps are specifically performed:
根据当前已产生的滑动轨迹采集多个滑动触点;确定相邻两个滑动触点的连线与预设轴的夹角;计算已确定的所有夹角的平均值;根据所述平均值以及所述预设轴的方向确定已进行的滑动操作的平均方向。Acquiring a plurality of sliding contacts according to the currently generated sliding track; determining an angle between the connecting lines of the adjacent two sliding contacts and the preset axis; calculating an average value of all the angles determined; according to the average value and The direction of the preset axis determines the average direction of the sliding operation that has been performed.
在一实施例中,处理器112执行根据当前已产生的滑动轨迹采集多个滑动 触点时,具体执行如下步骤:In an embodiment, when the processor 112 performs a plurality of sliding contacts according to the currently generated sliding track, the following steps are specifically performed:
根据当前已产生的滑动轨迹按照等时间间隔的方式采集多个滑动触点,或者根据当前已产生的滑动轨迹按照等距离间隔的方式采集多个滑动触点。A plurality of sliding contacts are collected in an equal time interval according to the currently generated sliding track, or a plurality of sliding contacts are collected in an equidistantly spaced manner according to the currently generated sliding track.
在一实施例中,处理器112执行根据当前已产生的滑动轨迹计算滑动方向时,具体执行如下步骤:In an embodiment, when the processor 112 performs the calculation of the sliding direction according to the currently generated sliding trajectory, the following steps are specifically performed:
根据当前已产生的滑动轨迹获取滑动轨迹开始时的第一触点和到达预设时间时的第二触点;根据所述第一触点和所述第二触点确定所述滑动方向。Acquiring the first contact at the start of the sliding track and the second contact when the preset time is reached according to the currently generated sliding track; determining the sliding direction according to the first contact and the second contact.
在一实施例中,处理器112执行对与所述滑动方向相同的滑动事件加上互斥锁时,具体执行如下步骤:In an embodiment, when the processor 112 performs the same sliding event as the sliding direction plus the mutex lock, the following steps are specifically performed:
判断是否创建了控件的互斥锁;若没有创建控件的互斥锁,创建控件的互斥锁;对与所述滑动方向相同的滑动事件加上获取的互斥锁。Determine whether the mutex of the control is created; if the mutex of the control is not created, create a mutex of the control; add the mutex obtained by the same sliding event as the sliding direction.
应当理解,在本申请实施例中,处理器112可以是中央处理单元(Central Processing Unit,CPU),该处理器112还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。其中,通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。It should be understood that, in the embodiment of the present application, the processor 112 may be a central processing unit (CPU), and the processor 112 may also be another general-purpose processor, a digital signal processor (DSP), Application Specific Integrated Circuit (ASIC), Field-Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware component, etc. The general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
本申请实施例还提供一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序包括程序指令,所述程序指令被执行时,实现以下步骤:The embodiment of the present application further provides a computer readable storage medium, where the computer readable storage medium stores a computer program, where the computer program includes program instructions, and when the program instructions are executed, the following steps are implemented:
若检测到控件上因滑动操作而触发的多个滑动事件,获取所述滑动操作的滑动时间和滑动轨迹;若所述滑动时间达到预设时间且所述滑动操作未结束,根据当前已产生的滑动轨迹计算滑动方向;对与所述滑动方向相同的滑动事件加上互斥锁;控制所述控件响应已加上互斥锁的滑动事件;若检测到所述滑动操作结束,解除所述互斥锁。If a plurality of sliding events triggered by the sliding operation on the control are detected, obtaining a sliding time and a sliding track of the sliding operation; if the sliding time reaches a preset time and the sliding operation is not ended, according to the currently generated The sliding track calculates a sliding direction; adding a mutex to the same sliding event as the sliding direction; controlling the control to respond to a sliding event to which the mutex has been added; and if detecting the sliding operation ending, releasing the mutual Rebel lock.
在一实施例中,该程序指令被处理器执行根据当前已产生的滑动轨迹计算滑动方向时,具体实现:In an embodiment, when the program instruction is executed by the processor to calculate the sliding direction according to the currently generated sliding track, the specific implementation is:
根据当前已产生的滑动轨迹计算已进行的滑动操作的平均方向;根据所述 平均方向确定所述滑动方向。The average direction of the sliding operation that has been performed is calculated based on the currently generated sliding trajectory; the sliding direction is determined based on the average direction.
在一实施例中,该程序指令被处理器执行根据当前已产生的滑动轨迹确定已进行的滑动操作的平均方向时,具体实现:In an embodiment, when the program instruction is executed by the processor to determine an average direction of the sliding operation that has been performed according to the currently generated sliding trajectory, the specific implementation is:
根据当前已产生的滑动轨迹采集多个滑动触点;确定相邻两个滑动触点的连线与预设轴的夹角;计算已确定的所有夹角的平均值;根据所述平均值以及所述预设轴的方向确定已进行的滑动操作的平均方向。Acquiring a plurality of sliding contacts according to the currently generated sliding track; determining an angle between the connecting lines of the adjacent two sliding contacts and the preset axis; calculating an average value of all the angles determined; according to the average value and The direction of the preset axis determines the average direction of the sliding operation that has been performed.
在一实施例中,处理器112执行根据当前已产生的滑动轨迹采集多个滑动触点时,具体执行:In an embodiment, when the processor 112 performs a plurality of sliding contacts according to the currently generated sliding trajectory, the processor 112 performs:
根据当前已产生的滑动轨迹按照等时间间隔的方式采集多个滑动触点,或者根据当前已产生的滑动轨迹按照等距离间隔的方式采集多个滑动触点。A plurality of sliding contacts are collected in an equal time interval according to the currently generated sliding track, or a plurality of sliding contacts are collected in an equidistantly spaced manner according to the currently generated sliding track.
在一实施例中,该程序指令被处理器执行根据当前已产生的滑动轨迹计算滑动方向时,具体实现:In an embodiment, when the program instruction is executed by the processor to calculate the sliding direction according to the currently generated sliding track, the specific implementation is:
根据当前已产生的滑动轨迹获取滑动轨迹开始时的第一触点和到达预设时间时的第二触点;根据所述第一触点和所述第二触点确定所述滑动方向。Acquiring the first contact at the start of the sliding track and the second contact when the preset time is reached according to the currently generated sliding track; determining the sliding direction according to the first contact and the second contact.
在一实施例中,该计算机程序被处理器执行对与所述滑动方向相同的滑动事件加上互斥锁时,具体实现:In an embodiment, when the computer program is executed by the processor to add a mutex lock to the same sliding event as the sliding direction, the specific implementation is:
判断是否创建了控件的互斥锁;若没有创建控件的互斥锁,创建控件的互斥锁;对与所述滑动方向相同的滑动事件加上获取的互斥锁。Determine whether the mutex of the control is created; if the mutex of the control is not created, create a mutex of the control; add the mutex obtained by the same sliding event as the sliding direction.
所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,上述描述的设备、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。在本申请所提供的几个实施例中,应该理解到,所揭露的设备、装置和方法,可以通过其它的方式实现。A person skilled in the art can clearly understand that for the convenience and brevity of the description, the specific working process of the device, the device and the unit described above can refer to the corresponding process in the foregoing method embodiment, and details are not described herein again. In the several embodiments provided by the present application, it should be understood that the disclosed apparatus, apparatus, and method may be implemented in other manners.
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到各种等效的修改或替换,这些修改或替换都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以权利要求的保护范围为准。The foregoing is only a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto, and any equivalents can be easily conceived by those skilled in the art within the technical scope disclosed in the present application. Modifications or substitutions are intended to be included within the scope of the present application. Therefore, the scope of protection of this application should be determined by the scope of protection of the claims.

Claims (20)

  1. 一种防止界面抖动的方法,其特征在于,所述方法包括:A method for preventing interface jitter, characterized in that the method comprises:
    若检测到控件上因滑动操作而触发的多个滑动事件,获取所述滑动操作的滑动时间和滑动轨迹;If a plurality of sliding events triggered by the sliding operation on the control are detected, obtaining a sliding time and a sliding track of the sliding operation;
    若所述滑动时间达到预设时间且所述滑动操作未结束,根据当前已产生的滑动轨迹计算滑动方向;If the sliding time reaches a preset time and the sliding operation is not completed, the sliding direction is calculated according to the currently generated sliding track;
    对与所述滑动方向相同的滑动事件加上互斥锁;Adding a mutex lock to the same sliding event as the sliding direction;
    控制所述控件响应已加上互斥锁的滑动事件;Controlling the control to respond to a sliding event with a mutex added;
    若检测到所述滑动操作结束,解除所述互斥锁。If it is detected that the sliding operation is over, the mutex is released.
  2. 如权利要求1所述的方法,其特征在于,所述根据当前已产生的滑动轨迹计算滑动方向,包括:The method of claim 1 wherein said calculating a sliding direction based on a currently generated sliding trajectory comprises:
    根据当前已产生的滑动轨迹计算已进行的滑动操作的平均方向;Calculating the average direction of the sliding operation that has been performed according to the currently generated sliding trajectory;
    根据所述平均方向确定所述滑动方向。The sliding direction is determined according to the average direction.
  3. 如权利要求2所述的方法,其特征在于,所述根据当前已产生的滑动轨迹计算已进行的滑动操作的平均方向,包括:The method according to claim 2, wherein said calculating an average direction of the sliding operation that has been performed based on the currently generated sliding trajectory comprises:
    根据当前已产生的滑动轨迹采集多个滑动触点;Acquiring a plurality of sliding contacts according to the currently generated sliding track;
    确定相邻两个滑动触点的连线与预设轴的夹角;Determining the angle between the line connecting two adjacent sliding contacts and the preset axis;
    计算已确定的所有夹角的平均值;Calculate the average of all angles that have been determined;
    根据所述平均值以及所述预设轴的方向确定已进行的滑动操作的平均方向。An average direction of the sliding operation that has been performed is determined based on the average value and the direction of the preset axis.
  4. 如权利要求3所述的方法,其特征在于,所述根据当前已产生的滑动轨迹采集多个滑动触点,包括:The method of claim 3, wherein the acquiring a plurality of sliding contacts based on the currently generated sliding trajectory comprises:
    根据当前已产生的滑动轨迹按照等时间间隔的方式采集多个滑动触点,或者根据当前已产生的滑动轨迹按照等距离间隔的方式采集多个滑动触点。A plurality of sliding contacts are collected in an equal time interval according to the currently generated sliding track, or a plurality of sliding contacts are collected in an equidistantly spaced manner according to the currently generated sliding track.
  5. 如权利要求1所述的方法,其特征在于,所述根据当前已产生的滑动轨迹计算滑动方向,包括:The method of claim 1 wherein said calculating a sliding direction based on a currently generated sliding trajectory comprises:
    根据当前已产生的滑动轨迹获取滑动轨迹开始时的第一触点和到达预设时间时的第二触点;Acquiring the first contact at the start of the sliding track and the second contact when the preset time is reached according to the currently generated sliding track;
    根据所述第一触点和所述第二触点确定所述滑动方向。The sliding direction is determined according to the first contact and the second contact.
  6. 一种防止界面抖动的装置,其特征在于,所述装置包括:A device for preventing interface jitter, characterized in that the device comprises:
    获取单元,用于若检测到控件上因滑动操作而触发的多个滑动事件,获取所述滑动操作的滑动时间和滑动轨迹;An acquiring unit, configured to acquire a sliding time and a sliding track of the sliding operation if a plurality of sliding events triggered by the sliding operation on the control are detected;
    计算单元,用于若所述滑动时间达到预设时间且所述滑动操作未结束,根据当前已产生的滑动轨迹计算滑动方向;a calculating unit, configured to calculate a sliding direction according to the currently generated sliding track if the sliding time reaches a preset time and the sliding operation is not completed;
    加锁单元,用于对与所述滑动方向相同的滑动事件加上互斥锁;a locking unit for adding a mutex lock to the same sliding event as the sliding direction;
    控制单元,用于控制所述控件响应已加上互斥锁的滑动事件;a control unit, configured to control the sliding response of the control to be added with a mutex;
    解除锁单元,用于若检测到所述滑动操作结束,解除所述互斥锁。The unlocking unit is configured to release the mutex if the sliding operation is detected to be finished.
  7. 如权利要求6所述的装置,其特征在于,所述计算单元,包括:The device according to claim 6, wherein the calculating unit comprises:
    平均方向计算单元,用于根据当前已产生的滑动轨迹计算已进行的滑动操作的平均方向;An average direction calculating unit, configured to calculate an average direction of the sliding operation that has been performed according to the currently generated sliding track;
    第一确定单元,用于根据所述平均方向确定所述滑动方向。a first determining unit, configured to determine the sliding direction according to the average direction.
  8. 如权利要求7所述的装置,其特征在于,所述平均方向计算单元,包括:The apparatus according to claim 7, wherein said average direction calculating unit comprises:
    采集单元,用于根据当前已产生的滑动轨迹采集多个滑动触点;a collecting unit, configured to collect a plurality of sliding contacts according to the currently generated sliding track;
    夹角确定单元,用于确定相邻两个滑动触点的连线与预设轴的夹角;An angle determining unit, configured to determine an angle between a line connecting two adjacent sliding contacts and a preset axis;
    平均夹角计算单元,用于计算已确定的所有夹角的平均值;An average angle calculation unit for calculating an average value of all the angles that have been determined;
    平均方向确定单元,用于所述平均值以及所述预设轴的方向确定已进行的滑动操作的平均方向。An average direction determining unit for the average value and the direction of the preset axis determines an average direction of the sliding operation that has been performed.
  9. 如权利要求8所述的装置,其特征在于,所述采集单元用于根据当前已产生的滑动轨迹按照等时间间隔的方式采集多个滑动触点,或者用于根据当前已产生的滑动轨迹按照等距离间隔的方式采集多个滑动触点。The device according to claim 8, wherein the collecting unit is configured to collect a plurality of sliding contacts in an equal time interval according to the currently generated sliding track, or to follow the currently generated sliding track according to the current sliding track. Acquire multiple sliding contacts in an equidistantly spaced manner.
  10. 如权利要求6所述的装置,其特征在于,所述计算单元包括触点获取单元、第二确定单元;其中,The device according to claim 6, wherein the calculation unit comprises a contact acquisition unit and a second determination unit;
    所述触点获取单元,用于根据当前已产生的滑动轨迹获取滑动轨迹开始时的第一触点和到达预设时间时的第二触点;The contact acquiring unit is configured to acquire a first contact at the start of the sliding track and a second contact when the preset time is reached according to the currently generated sliding track;
    所述第二确定单元,用于根据所述第一触点和所述第二触点确定所述滑动方向。The second determining unit is configured to determine the sliding direction according to the first contact and the second contact.
  11. 一种计算机设备,其特征在于,所述计算机设备包括存储器,以及与 所述存储器相连的处理器;A computer device, comprising: a memory, and a processor coupled to the memory;
    所述存储器用于存储实现防止界面抖动的的计算机程序;所述处理器用于运行所述存储器中存储的计算机程序,以执行如下步骤:The memory is for storing a computer program that implements preventing interface jitter; the processor is configured to run a computer program stored in the memory to perform the following steps:
    若检测到控件上因滑动操作而触发的多个滑动事件,获取所述滑动操作的滑动时间和滑动轨迹;If a plurality of sliding events triggered by the sliding operation on the control are detected, obtaining a sliding time and a sliding track of the sliding operation;
    若所述滑动时间达到预设时间且所述滑动操作未结束,根据当前已产生的滑动轨迹计算滑动方向;If the sliding time reaches a preset time and the sliding operation is not completed, the sliding direction is calculated according to the currently generated sliding track;
    对与所述滑动方向相同的滑动事件加上互斥锁;Adding a mutex lock to the same sliding event as the sliding direction;
    控制所述控件响应已加上互斥锁的滑动事件;Controlling the control to respond to a sliding event with a mutex added;
    若检测到所述滑动操作结束,解除所述互斥锁。If it is detected that the sliding operation is over, the mutex is released.
  12. 如权利要求11所述的计算机设备,其特征在于,所述处理器还执行如下步骤:The computer device of claim 11 wherein said processor further performs the following steps:
    根据当前已产生的滑动轨迹计算已进行的滑动操作的平均方向;Calculating the average direction of the sliding operation that has been performed according to the currently generated sliding trajectory;
    根据所述平均方向确定所述滑动方向。The sliding direction is determined according to the average direction.
  13. 如权利要求12所述的计算机设备,其特征在于,所述处理器还执行如下步骤:The computer device of claim 12 wherein said processor further performs the following steps:
    根据当前已产生的滑动轨迹采集多个滑动触点;Acquiring a plurality of sliding contacts according to the currently generated sliding track;
    确定相邻两个滑动触点的连线与预设轴的夹角;Determining the angle between the line connecting two adjacent sliding contacts and the preset axis;
    计算已确定的所有夹角的平均值;Calculate the average of all angles that have been determined;
    根据所述平均值以及所述预设轴的方向确定已进行的滑动操作的平均方向。An average direction of the sliding operation that has been performed is determined based on the average value and the direction of the preset axis.
  14. 如权利要求13所述的计算机设备,其特征在于,所述处理器执行根据当前已产生的滑动轨迹采集多个滑动触点时,具体执行:根据当前已产生的滑动轨迹按照等时间间隔的方式采集多个滑动触点,或者根据当前已产生的滑动轨迹按照等距离间隔的方式采集多个滑动触点。The computer device according to claim 13, wherein when the processor performs the acquisition of the plurality of sliding contacts according to the currently generated sliding trajectory, the processor performs: performing the time interval according to the currently generated sliding trajectory. A plurality of sliding contacts are collected, or a plurality of sliding contacts are collected at equal distances according to the currently generated sliding track.
  15. 如权利要求11所述的计算机设备,其特征在于,所述处理器还执行如下步骤:The computer device of claim 11 wherein said processor further performs the following steps:
    根据当前已产生的滑动轨迹获取滑动轨迹开始时的第一触点和到达预设时间时的第二触点;Acquiring the first contact at the start of the sliding track and the second contact when the preset time is reached according to the currently generated sliding track;
    根据所述第一触点和所述第二触点确定所述滑动方向。The sliding direction is determined according to the first contact and the second contact.
  16. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质存储有计算机程序,所述计算机程序包括程序指令,所述程序指令被处理器执行时,实现如下步骤:A computer readable storage medium, characterized in that the computer readable storage medium stores a computer program, the computer program comprising program instructions, when the program instructions are executed by the processor, implementing the following steps:
    若检测到控件上因滑动操作而触发的多个滑动事件,获取所述滑动操作的滑动时间和滑动轨迹;If a plurality of sliding events triggered by the sliding operation on the control are detected, obtaining a sliding time and a sliding track of the sliding operation;
    若所述滑动时间达到预设时间且所述滑动操作未结束,根据当前已产生的滑动轨迹计算滑动方向;If the sliding time reaches a preset time and the sliding operation is not completed, the sliding direction is calculated according to the currently generated sliding track;
    对与所述滑动方向相同的滑动事件加上互斥锁;Adding a mutex lock to the same sliding event as the sliding direction;
    控制所述控件响应已加上互斥锁的滑动事件;Controlling the control to respond to a sliding event with a mutex added;
    若检测到所述滑动操作结束,解除所述互斥锁。If it is detected that the sliding operation is over, the mutex is released.
  17. 如权利要求16所述的计算机可读存储介质,其特征在于,所述步骤还包括:The computer readable storage medium of claim 16 wherein said step further comprises:
    根据当前已产生的滑动轨迹计算已进行的滑动操作的平均方向;Calculating the average direction of the sliding operation that has been performed according to the currently generated sliding trajectory;
    根据所述平均方向确定所述滑动方向。The sliding direction is determined according to the average direction.
  18. 如权利要求17所述的计算机可读存储介质,其特征在于,所述步骤还包括:The computer readable storage medium of claim 17, wherein the step further comprises:
    根据当前已产生的滑动轨迹采集多个滑动触点;Acquiring a plurality of sliding contacts according to the currently generated sliding track;
    确定相邻两个滑动触点的连线与预设轴的夹角;Determining the angle between the line connecting two adjacent sliding contacts and the preset axis;
    计算已确定的所有夹角的平均值;Calculate the average of all angles that have been determined;
    根据所述平均值以及所述预设轴的方向确定已进行的滑动操作的平均方向。An average direction of the sliding operation that has been performed is determined based on the average value and the direction of the preset axis.
  19. 如权利要求18所述的计算机可读存储介质,其特征在于,所述程序指令被处理器执行根据当前已产生的滑动轨迹采集多个滑动触点时,实现:根据当前已产生的滑动轨迹按照等时间间隔的方式采集多个滑动触点,或者根据当前已产生的滑动轨迹按照等距离间隔的方式采集多个滑动触点。The computer readable storage medium according to claim 18, wherein the program instructions are executed by the processor to acquire a plurality of sliding contacts according to the currently generated sliding trajectory, and are implemented according to the currently generated sliding trajectory. Multiple sliding contacts are acquired in a time interval manner, or multiple sliding contacts are acquired in an equidistantly spaced manner according to the currently generated sliding track.
  20. 如权利要求16所述的计算机可读存储介质,其特征在于,所述步骤还包括:The computer readable storage medium of claim 16 wherein said step further comprises:
    根据当前已产生的滑动轨迹获取滑动轨迹开始时的第一触点和到达预设时间时的第二触点;Acquiring the first contact at the start of the sliding track and the second contact when the preset time is reached according to the currently generated sliding track;
    根据所述第一触点和所述第二触点确定所述滑动方向。The sliding direction is determined according to the first contact and the second contact.
PCT/CN2018/075043 2017-11-08 2018-02-02 Method, device and equipment for preventing interface from shaking, and computer-readable storage medium WO2019090996A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201711092114.3 2017-11-08
CN201711092114.3A CN107908344B (en) 2017-11-08 2017-11-08 Method, apparatus, equipment and the computer readable storage medium for preventing interface from shaking

Publications (1)

Publication Number Publication Date
WO2019090996A1 true WO2019090996A1 (en) 2019-05-16

Family

ID=61843754

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/075043 WO2019090996A1 (en) 2017-11-08 2018-02-02 Method, device and equipment for preventing interface from shaking, and computer-readable storage medium

Country Status (2)

Country Link
CN (1) CN107908344B (en)
WO (1) WO2019090996A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113254067B (en) * 2021-05-25 2022-03-08 四川虹魔方网络科技有限公司 Method for preventing function jitter based on Rx framework

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103324422A (en) * 2012-03-21 2013-09-25 宇龙计算机通信科技(深圳)有限公司 Terminal and track amending method
CN103677416A (en) * 2013-12-13 2014-03-26 广东欧珀移动通信有限公司 Method and device for preventing interface from shaking in sliding process
US20150254906A1 (en) * 2012-08-22 2015-09-10 Siemens Aktiengesellschaft Method and Arrangement for Transporting Cuboidal Items

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10620972B2 (en) * 2015-07-16 2020-04-14 Adobe Inc. Processing touch gestures in hybrid applications
CN107220134A (en) * 2017-06-26 2017-09-29 中广热点云科技有限公司 The solution that HTML5 and Android conflict when switching

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103324422A (en) * 2012-03-21 2013-09-25 宇龙计算机通信科技(深圳)有限公司 Terminal and track amending method
US20150254906A1 (en) * 2012-08-22 2015-09-10 Siemens Aktiengesellschaft Method and Arrangement for Transporting Cuboidal Items
CN103677416A (en) * 2013-12-13 2014-03-26 广东欧珀移动通信有限公司 Method and device for preventing interface from shaking in sliding process

Also Published As

Publication number Publication date
CN107908344B (en) 2019-09-10
CN107908344A (en) 2018-04-13

Similar Documents

Publication Publication Date Title
US10732819B2 (en) Method and mobile terminal for quickly opening an application based on lock screen
KR101572307B1 (en) Information processing apparatus, control method thereof, and storage medium
US9191633B2 (en) Tracking assistance device, tracking assistance system and tracking assistance method
CN103984502B (en) The method and portable terminal of a kind of screen printing content
US9514541B2 (en) Image processing apparatus and image processing method
CN102508615B (en) Touch screen picture control method
WO2017000350A1 (en) Touchscreen terminal-based unlock method and device and touchscreen terminal
WO2019136961A1 (en) User interface display identification method, terminal device, storage medium and apparatus
US20150062010A1 (en) Pointing-direction detecting device and its method, program and computer readable-medium
CN103902185B (en) Screen rotation method and device, mobile device
WO2015078353A1 (en) Touch screen control method and terminal equipment
JP5771401B2 (en) Mobile communication terminal
CN104461312A (en) Display control method and electronic equipment
CN105807965A (en) False trigger prevention method and apparatus
WO2019087638A1 (en) Information processing device and information processing method
WO2019090996A1 (en) Method, device and equipment for preventing interface from shaking, and computer-readable storage medium
US10901496B2 (en) Image processing apparatus, image processing method, and program
TWI587169B (en) System and method for locking and unlocking an electronic device
US20160266648A1 (en) Systems and methods for interacting with large displays using shadows
US20170115866A1 (en) Method, device and terminal apparatus for recognizing multi-finger sliding gesture
US9400929B2 (en) Object detection device and method for detecting an object by performing a raster scan on a scan window
TWI700629B (en) Method and device for controlling display direction
CN111986229A (en) Video target detection method, device and computer system
US20150253861A1 (en) Detecting device and detecting method
JP2013246822A (en) Method and system for clicking and localizing movement objet

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18876347

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 02.10.2020)

122 Ep: pct application non-entry in european phase

Ref document number: 18876347

Country of ref document: EP

Kind code of ref document: A1