Picture dynamic movement control method and device based on gesture recognition and storage medium
By adding a long-press gesture to the scrolling list and generating a screenshot that follows the finger movement in real time, the problem of the lack of continuity and stability in the movement of user interface elements is solved, resulting in a smooth user experience and system stability.
Patent Information
- Application Number
- CN202311444568.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-31
- Publication Date
- 2026-11-27
- Estimated Expiration
- 2043-10-31
AI Technical Summary
In existing technologies, the movement of user interface elements lacks continuity and smoothness, and is not stable enough when dealing with invalid or incorrect positions, which can easily lead to application crashes or interface chaos.
By adding a long-press gesture to the scrolling list, a screenshot is generated and follows the finger movement in real time. Combined with animation processing, a continuous dragging effect of the image is achieved, and the consistency of the data structure is ensured when the gesture ends.
It provides a continuous and smooth user interface movement experience, avoids program crashes caused by incorrect positioning, and enhances system stability and user interaction experience.
Smart Images

Figure CN117762303B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a method, apparatus and storage medium for dynamic image movement control based on gesture recognition. Background Technology
[0002] In modern application development, the smoothness and continuity of user experience and interface interaction have become key considerations. This is especially true for operations involving the movement of elements or objects within the user interface.
[0003] In a common technical implementation, when a UI element (called a "cell") needs to be moved from one location to another, a "one-time" movement method is used. Specifically, the cell moves to the destination location immediately and abruptly, without the user observing the transition or movement process from the starting position to the target position. This implementation can easily lead to confusion and a discontinuous user experience. Visually, the cell seems to suddenly disappear from one place and then suddenly reappear in another, and the user cannot perceive how the cell completes this positional change.
[0004] Furthermore, existing technologies are quite inadequate in handling situations where cells are moved to invalid or incorrect locations. For example, when a system attempts to move a cell to a position outside the allowed range of the interface or to a position already occupied by another cell, existing systems may fail to handle it properly. This inadequacy can lead to various potential problems, such as application crashes, interface clutter, data inconsistencies, or other unpredictable error states.
[0005] Therefore, given the above situation, there is an urgent need to provide an image movement control method that can realize a continuous and smooth cell movement experience in the user interface, and provide a more stable and reliable processing mechanism when dealing with cases where the cell moves to an invalid or incorrect position. Summary of the Invention
[0006] In view of this, embodiments of this application provide a method, apparatus and storage medium for dynamic image movement control based on gesture recognition, in order to solve the problem that existing technologies cannot achieve continuous and smooth image movement, and are prone to invalid processing and incorrect movement positions.
[0007] A first aspect of this application provides a method for dynamic image movement control based on gesture recognition, comprising: adding a long-press gesture to a scrolling list and setting the proxy object of the long-press gesture as the context object of the current environment; obtaining the touch point on the screen corresponding to the user's touch operation, determining whether the touch operation is valid based on the positional relationship between the touch point and the image in the scrolling list, and returning an instruction to allow the scrolling list to respond to finger swiping when the touch operation is valid; performing real-time judgment on the swiping state of the user's gesture, obtaining the position of the image touched by the user's gesture in the scrolling list when the user's gesture starts to swipe, and recording the position of the image touched by the user's gesture; generating a screenshot for the dragged image, adding the screenshot to the screen, and hiding the dragged image so that the screenshot can be dragged and moved when the finger swipes; when the user's gesture changes, detecting the current touch position of the finger, determining the image corresponding to the current touch position, moving the screenshot so that the position of the moved screenshot matches the current touch position, so that the screenshot follows the touch position of the finger; when the user's gesture stops, determining the position of the last valid image before stopping the dragging, matching the position of the screenshot to the position of the last valid image before stopping the dragging, unhiding the dragged image, and removing the screenshot from the screen.
[0008] A second aspect of this application provides a gesture recognition-based image dynamic movement control device, comprising: an adding module configured to add a long-press gesture to a scrolling list and set the proxy object of the long-press gesture as the context object of the current environment; an acquiring module configured to acquire a touch point on the screen corresponding to a user touch operation, determine whether the touch operation is valid based on the positional relationship between the touch point and the image in the scrolling list, and return an instruction to allow the scrolling list to respond to finger swiping when the touch operation is valid; and a judging module configured to judge the swiping state of the user's gesture in real time, acquire the position of the image touched by the user's gesture in the scrolling list when the user's gesture begins to swipe, and record the user's gesture touch. The system includes: an image position detection module; a generation module, configured to generate a screenshot for the dragged image, add the screenshot to the screen, and hide the dragged image so that it can be moved by dragging when the finger slides; a detection module, configured to detect the current touch position of the finger when the user's gesture changes, determine the image corresponding to the current touch position, move the screenshot so that the moved screenshot position matches the current touch position, so that the screenshot follows the touch position of the finger; and a matching module, configured to determine the position of the last valid image before the drag stops when the user's gesture stops, match the position of the screenshot to the position of the last valid image before the drag stops, unhide the dragged image, and remove the screenshot from the screen.
[0009] A third aspect of this application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the above-described method.
[0010] A fourth aspect of this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the above-described method.
[0011] The above-described technical solutions adopted in the embodiments of this application can achieve the following beneficial effects:
[0012] This is achieved by adding a long-press gesture to the scrolling list and setting the long-press gesture's delegate object as the current context object; obtaining the touch point on the screen corresponding to the user's touch operation; determining the validity of the touch operation based on the positional relationship between the touch point and the images in the scrolling list; returning an instruction to allow the scrolling list to respond to finger swipes when the touch operation is valid; real-time judgment of the user's gesture swipe state; obtaining and recording the position of the image touched by the user's gesture in the scrolling list when the user's gesture begins to swipe; generating a screenshot for the dragged image, adding the screenshot to the screen, and hiding the dragged image so that the screenshot can be dragged when the finger swipes; detecting the current touch position of the finger when the user's gesture changes, determining the image corresponding to the current touch position, moving the screenshot so that the moved screenshot position matches the current touch position, so that the screenshot follows the finger's touch position; and determining the position of the last valid image before the drag stops when the user's gesture stops, matching the screenshot position to the position of the last valid image before the drag stops, unhiding the dragged image, and removing the screenshot from the screen. This application achieves a continuous and smooth image movement experience, and provides a more stable and reliable processing mechanism when dealing with situations where images are moved to invalid or incorrect positions. Attached Figure Description
[0013] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0014] Figure 1 This is a flowchart illustrating the image dynamic movement control method based on gesture recognition provided in an embodiment of this application.
[0015] Figure 2This is a schematic diagram of the image dynamic movement control device based on gesture recognition provided in the embodiments of this application;
[0016] Figure 3 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0017] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this application with unnecessary detail.
[0018] This application provides an algorithm for data entry to be swapped as the finger moves, addressing existing problems in the prior art. The basic implementation steps and principles of this technical solution are as follows: In the iOS system's scrolling list (tableView), the system provides a function called `moveRow`, which can directly move the cell's position. In this embodiment, it is referred to as "Method 1". The characteristic of this function is that it can quickly and instantly change the cell's position; however, this instantaneous movement lacks a transition effect, making it impossible for the user to see the continuous movement of the cell.
[0019] Furthermore, to enhance the visual motion experience, this application proposes an innovative method. Specifically, when a user attempts to drag a cell, the system first creates a screenshot of the dragged cell and displays it on the screen. Thus, when the user drags the cell, they are actually moving the screenshot, creating a continuous visual effect that moves with the finger.
[0020] Furthermore, as the user's finger moves, the system controls the screenshot's position in real time, ensuring that the screenshot always follows the user's finger's movement. This allows the user to feel as if the cell is being "caught" by the finger and dragged in real time.
[0021] Furthermore, although the user sees the screenshot moving, behind the scenes, the system also calls the previously mentioned "Method 1" (moveRow function) to actually move the cell's position. This way, when the user releases their finger, the cell instantly moves to the target position, matching the previous screenshot location.
[0022] Through the above steps, the technical solution of this application not only retains the real-time movement function of the original moveRow function, but also adds a continuous movement effect based on screenshots, which greatly enhances the user experience and realizes a more intuitive and smooth cell movement operation.
[0023] The technical solution of this application will now be described in detail with reference to the accompanying drawings and specific embodiments.
[0024] Figure 1 This is a flowchart illustrating the image dynamic movement control method based on gesture recognition provided in an embodiment of this application. Figure 1 The gesture recognition-based image dynamic movement control method can be executed by an application. For example... Figure 1 As shown, the image dynamic movement control method based on gesture recognition can specifically include:
[0025] S101, Add a long press gesture to the scroll list and set the proxy object of the long press gesture as the context object of the current environment;
[0026] S102, obtain the touch point on the screen corresponding to the user's touch operation, determine whether the touch operation is valid based on the positional relationship between the touch point and the image in the scrolling list, and return the instruction to allow the scrolling list to respond to finger swipes when the touch operation is valid;
[0027] S103, Real-time judgment of the user's gesture swiping state. When the user's gesture starts to swipe, obtain the position of the image touched by the user's gesture in the scrolling list and record the position of the image touched by the user's gesture.
[0028] S104, Generate a screenshot of the dragged image, add the screenshot to the screen, and hide the dragged image so that the screenshot can be dragged when the finger is swiped;
[0029] S105, When the user's gesture changes, detect the current touch position of the finger, determine the image corresponding to the current touch position, move the screenshot so that the moved screenshot position matches the current touch position, so that the screenshot moves with the touch position of the finger;
[0030] S106, when the user's gesture stops, determine the position of the last valid image before the drag stops, match the position of the screenshot to the position of the last valid image before the drag stops, unhide the dragged image, and remove the screenshot from the screen.
[0031] First, some technical terms involved in the embodiments of this application in practical application scenarios will be explained, which may include the following:
[0032] TableView (also known as UITableView): In iOS, UITableView is a UI control primarily used to display a vertically scrolling list. Each UITableView consists of multiple rows (cells), and each row can represent one piece of data or information. It provides applications with a highly customized way to display data lists, including text, images, or other types of UI elements. UITableView is commonly used in messaging apps, contact lists, settings interfaces, and other scenarios where multiple data items need to be displayed in a list format.
[0033] A cell (UITableViewCell or UICollectionViewCell): In iOS's UITableView and UICollectionView, a cell is a UI component primarily used to display and represent a single data item in a list. A cell can contain text, images, buttons, or other UI elements. Its design and layout can be highly customized to meet the needs of different applications. In this application, a cell is used to represent and display an image, but in other application scenarios, a cell can represent different kinds of data or content.
[0034] UIGestureRecognizer: In iOS, UIGestureRecognizer is an abstract base class used to handle various user interface gestures, such as taps, drags, pinches, and rotations. The UIGestureRecognizer class provides a basic framework for gesture recognition and response. Developers can customize gesture recognition and processing logic by subclassing or implementing its delegate methods. In applications, UIGestureRecognizer is commonly used to recognize and process user gestures on the screen to achieve various interactive effects.
[0035] Began, changed, ended: These are enumeration values defined in the UIGestureRecognizer class, used to identify the current state of a gesture.
[0036] Among them, `began`: When the gesture recognizer detects the start of a new gesture, its state is set to `began`. `changed`: When an already started gesture undergoes any change (such as a change in position or rotation angle), its state is updated to `changed`. `ended`: When the gesture ends, such as when the user's finger leaves the screen, its state is updated to `ended`. By monitoring the state of `UIGestureRecognizer`, developers can execute corresponding code at different gesture stages to achieve complex interactive effects.
[0037] In some embodiments, adding a long-press gesture to a scrolling list and setting the proxy object of the long-press gesture as the context object of the current environment includes: adding a long-press gesture recognizer to the scrolling list and specifying the proxy attribute of the long-press gesture recognizer as the context object of the current execution environment, so that the scrolling list can respond to and process gesture swipe events.
[0038] Specifically, to enable users to drag on a scrolling list, this embodiment provides a method for triggering drag functionality via a long-press gesture. First, a long-press gesture recognizer is added to the scrolling list (i.e., the tableView). This long-press gesture recognizer is an instance of the UILongPressGestureRecognizer class in iOS. By initializing this gesture recognizer and adding it to the tableView's gesture recognizer collection, the tableView can recognize and respond to long-press operations performed by the user.
[0039] However, simply adding a gesture recognizer is not enough. To ensure that the tableView can correctly handle the relevant gesture events when a gesture occurs, a delegate object needs to be set to respond to these events. Here, this embodiment chooses to specify the delegate property of the long press gesture recognizer as the context object of the current execution environment. Therefore, when the user performs a long press operation on the tableView, all events related to this gesture will be passed to this context object for processing.
[0040] Furthermore, when a user long-presses on a cell in the tableView, the tableView can recognize the gesture because a long-press gesture recognizer is set up. Subsequently, the delegate object will receive event notifications related to this gesture, such as the start, change, and end of the gesture. By handling these events, the delegate object can execute related logic, such as creating a screenshot of the cell, controlling the position of the screenshot to simulate a dragging effect, or using the moveRow method mentioned earlier to implement actual cell position movement.
[0041] According to the method provided in the above embodiments, by adding a long-press gesture recognizer to the tableView and setting an appropriate delegate object, dragging functionality on the tableView can be implemented, allowing users to intuitively see the dragging effect while ensuring that the cell can be correctly moved to the target position. This method not only provides a consistent and intuitive user experience, but also, through the delegate object, allows developers to flexibly handle various gesture-related events, enabling more functions and interactive effects.
[0042] In some embodiments, determining whether a touch operation is valid based on the positional relationship between the touch point and the images in the scrolling list includes: checking whether there is an image containing the touch point in the scrolling list; if there is an image containing the touch point, the touch operation is determined to be valid, and the scrolling list responds to the finger swipe operation; if there is no image containing the touch point, the touch operation is determined to be invalid, and the scrolling list does not respond to the finger swipe operation.
[0043] Specifically, in order to provide a more intuitive and user-friendly experience, this application considers whether touch operations should be considered valid by the scrolling list in some embodiments. That is, a touch operation is only considered valid when the user's touch point happens to fall on a certain image (or cell) of the scrolling list, and the scrolling list will respond to the finger's swipe operation.
[0044] In one example, this embodiment introduces a key method, gestureRecognizerShouldBegin(_gestureRecognizer:UIGestureRecognizer)->Bool, hereinafter referred to as "Method 2". Method 2 is part of the UIGestureRecognizerDelegate protocol in iOS and is used to determine whether a particular gesture recognizer should begin interpreting a touch sequence as the gesture.
[0045] Furthermore, method 2 is triggered when a user's finger touches the screen and attempts to interact with the scrolling list. Within this method, the position of the touch point is first obtained. Then, it is checked whether this position coincides with the position of a specific image (cell) in the scrolling list.
[0046] If the touch point falls within the area of a cell, it means the user is attempting to interact with that cell. In this case, the touch operation is considered valid, and method 2 returns true. The scrolling list will then respond to this finger swipe and allow subsequent dragging, scrolling, and other operations.
[0047] However, if the touch point does not coincide with any cell, the user may have accidentally touched or touched an empty area of the scroll list. In this case, the touch operation is considered invalid, and method 2 returns false; the scroll list will not respond to this swipe operation.
[0048] The method provided in the above embodiments ensures that the scrolling list only responds to a user's swipe action when the user actually intends to interact with a specific image (cell) in the list. This provides users with a smoother and more intuitive experience when using the scrolling list, avoiding accidental touches or unnecessary swipe responses.
[0049] In some embodiments, adding a screenshot to the screen and hiding the draggable image so that the screenshot can be dragged when the finger is swiped includes: obtaining the screenshot corresponding to the draggable image, displaying the screenshot of the draggable image on the screen, and hiding the draggable image from the screen at the same time, so that when the user swipes their finger on the screen, the screenshot of the draggable image moves in real time within the screen following the user's finger.
[0050] Specifically, to provide a vivid and near-realistic dragging experience, this embodiment will use a screenshot of the dragged target to simulate its actual movement. The advantage of this is that the user sees a continuous and smooth dragging effect, while no changes occur in the actual data or view structure, thus avoiding potential complexity and instability. The following is a detailed processing procedure of the method in this embodiment:
[0051] First, when a user long-presses on an image (cell) in the scrolling list, a previously defined long-press gesture is triggered. This gesture is monitored in real time to determine its current state. In this embodiment, a dedicated method, referred to as "Method 3," is used to implement this functionality.
[0052] Furthermore, when the gesture state is "began," meaning the user has just started dragging, the position of the dragged cell is first obtained, called the originIndexPath. This positional information is crucial for subsequent operations because it is necessary to ensure that the data can be correctly reordered after the dragging is completed.
[0053] Furthermore, after recording the originIndexPath, immediately capture a screenshot of that cell. This can be achieved by calling specific graphics methods; for example, in iOS, this can be done using UIGraphicsBeginImageContextWithOptions and related functions. After capturing the screenshot, add it to the screen, ensuring its position perfectly overlaps with the original cell.
[0054] Furthermore, to create the effect of a cell being dragged out, this embodiment needs to hide the original cell at the originIndexPath location. Therefore, the user can only see the newly added screenshot, while the original cell is hidden, avoiding any potential visual clashes.
[0055] Furthermore, as the user continues to swipe their finger, the screenshot needs to move accordingly to simulate a realistic dragging effect. This can be achieved by listening to the "changed" state of the gesture and updating the screenshot's position in real time.
[0056] According to the method provided in the above embodiments, the core idea of this method is to simulate the real dragging effect by taking screenshots, thereby providing a continuous and smooth user experience, while avoiding any changes to the actual data structure or view structure, thus enhancing the stability and responsiveness of the program.
[0057] In some embodiments, before moving the screenshot to match the current touch position, the method further includes: using the image position touched by the user's gesture and the current touch position of the finger as parameters, and using a predetermined real-time finger swipe monitoring method, swapping the image position touched by the user's gesture and the current touch position of the finger in a scrolling list.
[0058] Specifically, to enhance the realism of the dragging effect and ensure that the data is updated correctly and efficiently behind the scenes, this embodiment utilizes a previously defined gesture method to achieve real-time position switching before dragging the screenshot to match the current finger touch position. The following are the specific implementation steps of this technical solution:
[0059] As mentioned earlier, this embodiment includes a dedicated method for monitoring user gesture states, referred to as "Method 3". This method responds in real-time when the user swipes their finger across the scrolling list. When the gesture state is "changed," meaning the user is dragging, it's necessary not only to track the finger's position on the screen but also to determine the position of the cell corresponding to the finger's current touch point in the scrolling list. This position is called `getIndexPath`. To obtain this information, the corresponding `tableView` method, such as `indexPathForRowAtPoint`, can be used to accurately determine which cell the finger is currently touching.
[0060] Furthermore, with the two key location information points, originIndexPath and targetIndexPath, the real-time position swapping of the two cells can be achieved. To this end, this embodiment calls "Method 1," passing these two locations as parameters. Thus, even if the user sees the screenshot moving, the positions of the two cells have already been updated in the actual data structure behind the scenes.
[0061] Furthermore, after completing the above operations, in order to stay synchronized with the user's actions, the screenshot position mentioned earlier also needs to be updated in real time. This way, the screenshot will accurately follow the user's finger movement on the screen, providing the user with a continuous and smooth visual experience.
[0062] According to the method provided in the above embodiments, by combining real-time monitoring of gestures, screenshot movement, and actual data position swapping, this embodiment achieves a dragging effect that is both efficient and realistic. This not only provides users with an excellent interactive experience but also ensures that the data is processed correctly behind the scenes.
[0063] In some embodiments, after moving the screenshot to match the current touch position, the method further includes: setting the value of the image position touched by the user's gesture to the value of the current touch position of the finger, so as to update the current touch position of the finger, and using the updated current touch position of the finger as the starting position of the next screenshot movement.
[0064] Specifically, to achieve a continuous and smooth dragging effect and ensure that the screenshot is always synchronized with the user's gesture operation, this embodiment employs a technique of dynamically updating the touch position. The following is a detailed implementation process of the technical solution in this embodiment:
[0065] First, during real-time monitoring of the user's dragging gestures, the screenshot position is updated in real time with each finger movement, ensuring it always matches the current touch position of the finger. This real-time update ensures the smoothness and realism of the dragging effect.
[0066] Furthermore, after the screenshot's position is updated, it's crucial to ensure that this position becomes the starting point for the next drag operation. To achieve this, the image position corresponding to the user's touch gesture needs to be updated in real-time, ensuring it aligns with the current touch position of the finger. For example, the value of `originIndexPath` can be set to the latest value of `targetIndexPath`. This way, in consecutive drag operations, the updated `originIndexPath` will serve as the starting point for the next drag.
[0067] This dynamic update mechanism ensures smoothness during continuous dragging. Even if the user changes the dragging direction or speed, the screenshot and actual cell position still respond accurately and quickly to the user's operation. This embodiment successfully achieves an accurate and efficient dragging effect, meeting the high requirements of users during interaction.
[0068] In some embodiments, determining the position of the last valid image before stopping dragging and matching the position of the screenshot to the position of the last valid image before stopping dragging includes: real-time monitoring and recording the position of the last valid image touched by the user before stopping dragging, adjusting the position of the screenshot using a preset animation method so that the position of the screenshot matches the position of the last valid image before stopping dragging, and smoothly moving the screenshot to the position of the last valid image.
[0069] Specifically, to ensure the screenshot smoothly returns to its proper position after the user's dragging gesture ends, this embodiment employs a specific animation processing method. The following is a detailed implementation process of the technical solution in this embodiment:
[0070] First, during the user's dragging gesture, the system continuously monitors the gesture's state. When the gesture state changes to "ended," it indicates that the user's finger has left the tableview, and the dragging operation ends. Based on the real-time updated information in the aforementioned embodiment, the position of the last valid image before the user stops dragging can be determined, which is referred to here as "finalIndexPath."
[0071] Furthermore, to achieve the effect of the screenshot smoothly returning to its proper position, a preset animation method is used to adjust the screenshot's position. The target position of the animation is the position of the cell corresponding to "finalIndexPath". During the animation, the screenshot will move from its current position to the target position along a smooth trajectory.
[0072] Furthermore, after the smooth transition animation mentioned above ends, firstly, the previously hidden cell needs to be displayed to ensure it is in the correct position; then, the screenshot is removed from the interface, because it has now completed its task and no longer needs to be displayed on the interface.
[0073] Furthermore, after the entire drag-and-drop process is complete, it's necessary to ensure that the tableview's data source and the order of the cells displayed on the screen remain consistent. This is to ensure that any subsequent operations, such as scrolling and refreshing, are based on the correct data.
[0074] According to the method provided in the above embodiments, this application not only ensures that the screenshot can smoothly return to its proper position, but also guarantees the continuity of the entire dragging process and the smoothness of the user experience. At the same time, data consistency is also ensured, laying a solid foundation for subsequent operations.
[0075] According to the technical solution provided in the embodiments of this application, the embodiments of this application have the following advantages:
[0076] This application's technical solution introduces animated transition effects, providing users with clear and smooth visual feedback during cell dragging and position changes. This dynamic effect not only enhances the visibility of the interaction but also improves the user experience.
[0077] This application leverages real-time monitoring of gesture states and adjusts the cell position accordingly. This solution provides users with intuitive and flexible operational capabilities, allowing them to easily specify the target position of the cell's movement simply by swiping their fingers. This instantaneous operational response also brings users a high degree of interactive freedom.
[0078] This application's technical solution specifically considers invalid movement positions and related boundary conditions. By properly handling these special cases, this solution effectively avoids program errors or crashes that may be caused by incorrect position operations. This attention to detail ensures the stability and robustness of the overall system.
[0079] The following are embodiments of the apparatus described in this application, which can be used to execute the embodiments of the method described in this application. For details not disclosed in the apparatus embodiments of this application, please refer to the embodiments of the method described in this application.
[0080] Figure 2 This is a schematic diagram of the image dynamic movement control device based on gesture recognition provided in an embodiment of this application. Figure 2 As shown, the gesture recognition-based image dynamic movement control device includes:
[0081] Add module 201, which is configured to add a long press gesture to the scroll list and set the proxy object of the long press gesture as the context object of the current environment;
[0082] The acquisition module 202 is configured to acquire the touch point on the screen corresponding to the user's touch operation, determine whether the touch operation is valid based on the positional relationship between the touch point and the image in the scrolling list, and return an instruction to allow the scrolling list to respond to finger swipes when the touch operation is valid.
[0083] The judgment module 203 is configured to make real-time judgments on the sliding state of the user's gesture. When the user's gesture starts to slide, it obtains the position of the image touched by the user's gesture in the scrolling list and records the position of the image touched by the user's gesture.
[0084] The generation module 204 is configured to generate a screenshot for the dragged image, add the screenshot to the screen, and hide the dragged image so that the screenshot can be dragged when the finger is swiped.
[0085] The detection module 205 is configured to detect the current touch position of the finger when the user's gesture changes, determine the image corresponding to the current touch position, move the screenshot so that the moved screenshot position matches the current touch position, so that the screenshot moves with the touch position of the finger.
[0086] The matching module 206 is configured to determine the position of the last valid image before the user's gesture stops when the gesture stops, match the position of the screenshot to the position of the last valid image before the user's gesture stops, unhide the dragged image, and remove the screenshot from the screen.
[0087] In some embodiments, Figure 2 The addition module 201 adds a long press gesture recognizer to the scroll list and specifies the delegate property of the long press gesture recognizer as the context object of the current execution environment so that the scroll list can respond to and process gesture swipe events.
[0088] In some embodiments, Figure 2 The acquisition module 202 checks whether there is an image containing a touch point in the scrolling list. When there is an image containing a touch point, the touch operation is determined to be a valid operation, and the scrolling list responds to the finger swipe operation. When there is no image containing a touch point, the touch operation is determined to be an invalid operation, and the scrolling list does not respond to the finger swipe operation.
[0089] In some embodiments, Figure 2 The generation module 204 obtains the screenshot corresponding to the dragged image, displays the screenshot of the dragged image on the screen, and hides the dragged image from the screen at the same time. When the user slides their finger on the screen, the screenshot of the dragged image moves in real time within the screen following the user's finger.
[0090] In some embodiments, Figure 2 Before the detection module 205 moves the screenshot and matches the moved screenshot position with the current touch position, it uses the image position touched by the user's gesture and the current touch position of the finger as parameters, and uses a predetermined real-time finger swipe monitoring method to swap the image position touched by the user's gesture and the current touch position of the finger in the scrolling list.
[0091] In some embodiments, Figure 2 After the detection module 205 moves the screenshot and matches the current touch position with the new screenshot position, it sets the value of the image position touched by the user's gesture to the value of the current touch position of the finger so as to update the current touch position of the finger and use the updated current touch position of the finger as the starting position of the next screenshot movement.
[0092] In some embodiments, Figure 2 The matching module 206 monitors and records in real time the position of the last valid image touched by the user before stopping dragging, and uses a preset animation method to adjust the position of the screenshot so that the position of the screenshot matches the position of the last valid image before stopping dragging, and the screenshot moves smoothly to the position of the last valid image.
[0093] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0094] Figure 3 This is a schematic diagram of the structure of the electronic device 3 provided in an embodiment of this application. Figure 3 As shown, the electronic device 3 of this embodiment includes a processor 301, a memory 302, and a computer program 303 stored in the memory 302 and executable on the processor 301. When the processor 301 executes the computer program 303, it implements the steps in the various method embodiments described above. Alternatively, when the processor 301 executes the computer program 303, it implements the functions of each module / unit in the various device embodiments described above.
[0095] For example, computer program 303 may be divided into one or more modules / units, which are stored in memory 302 and executed by processor 301 to complete this application. The one or more modules / units may be a series of computer program instruction segments capable of performing a specific function, which describe the execution process of computer program 303 in electronic device 3.
[0096] Electronic device 3 can be a desktop computer, laptop, handheld computer, cloud server, or other electronic device. Electronic device 3 may include, but is not limited to, processor 301 and memory 302. Those skilled in the art will understand that... Figure 3 This is merely an example of electronic device 3 and does not constitute a limitation on electronic device 3. It may include more or fewer components than shown, or combine certain components, or different components. For example, electronic device may also include input / output devices, network access devices, buses, etc.
[0097] Processor 301 can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor.
[0098] The memory 302 can be an internal storage unit of the electronic device 3, such as a hard disk or RAM. The memory 302 can also be an external storage device of the electronic device 3, such as a plug-in hard disk, Smart Media Card (SMC), Secure Digital (SD) card, or Flash Card. Furthermore, the memory 302 can include both internal and external storage units of the electronic device 3. The memory 302 is used to store computer programs and other programs and data required by the electronic device. The memory 302 can also be used to temporarily store data that has been output or will be output.
[0099] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0100] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0101] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0102] In the embodiments provided in this application, it should be understood that the disclosed apparatus / computer devices and methods can be implemented in other ways. For example, the apparatus / computer device embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. Multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0103] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0104] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0105] If integrated modules / units are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program may include computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. Computer-readable media may include: any entity or device capable of carrying computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc.
[0106] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.
Claims
1. A method for dynamic image movement control based on gesture recognition, applied to a scrolling list (tableView) in iOS systems, characterized in that... include: Add a long-press gesture to the scrolling list, and set the proxy object of the long-press gesture as the context object of the current execution environment; Get the touch point on the screen corresponding to the user's touch operation, and determine whether the touch operation is valid based on the positional relationship between the touch point and the image in the scrolling list. If the touch operation is valid, return an instruction to allow the scrolling list to respond to finger swipes. The system performs real-time judgment of the user's gesture swiping state. When the user's gesture starts to swipe, it obtains the position of the image touched by the user's gesture in the scrolling list and records the position of the image touched by the user's gesture, originIndexPath. A screenshot is generated for the dragged image by calling a preset graphics method, the screenshot is added to the image position originIndexPath of the user's gesture touch on the screen, and the dragged image is hidden so that the screenshot can be dragged when the finger is swiped. When the user's gesture changes, the current touch position of the finger is detected, and the image position targetIndexPath corresponding to the current touch position in the scrolling list is determined. When the screenshot is moved, the image position originIndexPath of the user's gesture touch and the image position targetIndexPath corresponding to the current touch position are swapped in the scrolling list so that the moved screenshot position matches the current touch position, so that the screenshot moves with the touch position of the finger. The value of the image position originIndexPath of the user's gesture touch is updated to the value of the image position targetIndexPath corresponding to the current touch position, which is used as the starting position for the next screenshot movement. When the user's gesture stops, determine the image position targetIndexPath corresponding to the last valid touch operation before the drag stops, match the position of the screenshot to the image position targetIndexPath corresponding to the last valid touch operation before the drag stops, unhide the dragged image, and remove the screenshot from the screen.
2. The image dynamic movement control method based on gesture recognition according to claim 1, characterized in that, The step of adding a long-press gesture to the scrolling list and setting the proxy object of the long-press gesture as the context object of the current execution environment includes: Add a long-press gesture recognizer to the scrolling list and specify the delegate attribute of the long-press gesture recognizer as the context object of the current execution environment so that the scrolling list can respond to and process gesture swipe events.
3. The image dynamic movement control method based on gesture recognition according to claim 1, characterized in that, The step of determining whether a touch operation is valid based on the positional relationship between the touch point and the images in the scrolling list includes: The scrolling list checks if an image containing the touch point exists. If an image containing the touch point exists, the touch operation is considered valid, and the scrolling list responds to the finger's swipe operation. If no image contains the touch point, the touch operation is considered invalid, and the scrolling list does not respond to the finger's swipe operation.
4. The image dynamic movement control method based on gesture recognition according to claim 1, characterized in that, The step of adding the screenshot to the image location originIndexPath on the screen where the user gestures, and hiding the draggable image so that the screenshot can be dragged when the finger is swiped, includes: Obtain a screenshot corresponding to the dragged image, display the screenshot of the dragged image on the screen, and simultaneously hide the dragged image from the screen. When the user slides their finger on the screen, the screenshot of the dragged image moves in real time within the screen following the user's finger.
5. The image dynamic movement control method based on gesture recognition according to claim 1, characterized in that, When moving the screenshot, swapping the positions of the image location originIndexPath (where the user's gesture touches the image) and the image location targetIndexPath (where the current touch location is located) in the scrolling list to match the moved screenshot location with the current touch location includes: Using the image location originIndexPath of the user's gesture touch and the targetIndexPath of the current finger touch as parameters, and employing a predetermined real-time finger swipe monitoring method, the positions of the image location originIndexPath of the user's gesture touch and the targetIndexPath of the current finger touch are swapped in the scrolling list.
6. The image dynamic movement control method based on gesture recognition according to claim 1, characterized in that, Determining the targetIndexPath of the image corresponding to the last valid touch operation before dragging stops, and matching the screenshot position to the targetIndexPath of the image corresponding to the last valid touch operation before dragging stops, includes: The system monitors and records in real time the position (targetIndexPath) of the image corresponding to the last valid touch operation before the user stops dragging. It then uses a preset animation method to adjust the position of the screenshot so that the position of the screenshot matches the position (targetIndexPath) of the image corresponding to the last valid touch operation before the user stops dragging. The screenshot is then smoothly moved to the position (targetIndexPath) of the image corresponding to the last valid touch operation.
7. A gesture recognition-based image dynamic movement control device, characterized in that, include: Add a module, configured to add a long press gesture to the scroll list, and set the proxy object of the long press gesture as the context object of the current execution environment; The acquisition module is configured to acquire the touch point on the screen corresponding to the user's touch operation, determine whether the touch operation is valid based on the positional relationship between the touch point and the image in the scrolling list, and return an instruction to allow the scrolling list to respond to finger swipes when the touch operation is valid. The judgment module is configured to make real-time judgments on the swiping state of the user's gesture. When the user's gesture starts to swipe, it obtains the position of the image touched by the user's gesture in the scrolling list and records the position of the image touched by the user's gesture, originIndexPath. The generation module is configured to generate a screenshot for the dragged image by calling a preset graphics method, add the screenshot to the image position originIndexPath of the user's gesture touch on the screen, and hide the dragged image so that the screenshot can be dragged when the finger is swiped. The detection module is configured to detect the current touch position of the finger when the user's gesture changes, and determine the image position targetIndexPath corresponding to the current touch position in the scrolling list. When moving the screenshot, the image position originIndexPath touched by the user's gesture and the image position targetIndexPath corresponding to the current touch position are swapped in the scrolling list so that the moved screenshot position matches the current touch position, so that the screenshot moves with the touch position of the finger. The value of the image position originIndexPath touched by the user's gesture is updated to the value of the image position targetIndexPath corresponding to the current touch position, which is used as the starting position for the next screenshot movement. The matching module is configured to, when the user's gesture stops, determine the targetIndexPath of the image corresponding to the last valid touch operation before the drag stops, match the position of the screenshot to the targetIndexPath of the image corresponding to the last valid touch operation before the drag stops, unhide the dragged image, and remove the screenshot from the screen.
8. An electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the image dynamic movement control method based on gesture recognition as described in any one of claims 1 to 6.
9. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the image dynamic movement control method based on gesture recognition as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Desktop reveal by moving a logical display stack with gestures
CN103262010A
Region selection method and apparatus, and graphic user interface
CN107066167A
