Event triggering method and device, equipment and storage medium

Through the data structure division and node traversal of the quadrant four-point tree, the incident response efficiency problem when there are many elements in the collaborative artboard is solved, and fast and accurate event triggering is achieved.

CN120276721APending Publication Date: 2025-07-08GUANGZHOU SHIZHEN INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311842410.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-12-28
Publication Date
2025-07-08

AI Technical Summary

Technical Problem

In the case where there are many elements drawn in the collaborative artboard, the prior art needs to traverse various nodes in the tree structure to determine the target event triggered by the user, resulting in an increase in response time and reducing the event response efficiency.

Method used

The data structure of the quadrant quadrant tree divides the operation interface of the collaborative artboard into multiple quadrants, and a quadrant quadrant tree is constructed based on the preset tree structure. By traversing the nodes corresponding to the target quadrant, the target elements of the user touch are determined and its preset events are triggered.

Benefits of technology

When there are many elements in the collaborative artboard, you only need to traverse the target quadrant nodes in the quadrant four-point tree, which improves event response efficiency, reduces invalid node traversal, and improves event response speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120276721A_ABST
    Figure CN120276721A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of computers, and discloses an event triggering method which comprises the following steps: dividing an operation interface of a collaborative drawing board into a plurality of quadrants according to a data structure of a quadrant quadrant; constructing a quadrant quadrant based on a preset tree structure; wherein the quadrant quadtree is used for storing position information of each element in the collaborative drawing board; when a user executes a touch operation on the operation interface, determining a target quadrant from a plurality of quadrants according to a touch position of the touch operation; and traversing each node corresponding to the target quadrant in the quadrant tree, determining a target element touched by the user, and triggering a preset target event of the target element. According to the method, the response efficiency of the event bound with the target element can be improved when the collaborative drawing board has more elements and the user edits the elements in the collaborative drawing board. The invention furthermore discloses an event triggering apparatus and device, and a storage medium.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and particularly to a method, device, equipment, and storage medium for triggering events. Background Art

[0002] Currently, users often use a collaborative drawing board running on an electronic device for drawing work. To enhance the user experience in drawing on the collaborative drawing board, the elements drawn in the collaborative drawing board can be bound to events set by the user. In this way, when the user touches an element in the collaborative drawing board, the event bound to the element can be triggered, and the event process can be executed. Thus, it is beneficial for the user to edit the elements in the collaborative drawing board.

[0003] The position information of each element in the collaborative drawing board is usually stored in a tree structure. In the related art, when the user edits an element in the collaborative drawing board, according to the position touched by the user, by traversing the position information of the elements stored in each node of the tree structure, the target element touched by the user in the collaborative drawing board can be determined, and the target event bound to the target element can be triggered.

[0004] However, in the related art, when determining the target event triggered by the user, it is necessary to traverse each node in the tree structure. In this way, when there are a large number of elements drawn in the collaborative drawing board, the number of nodes in the tree structure for storing the position information of each element will also be large, resulting in a long time-consuming to traverse each node in the tree structure when determining the target event triggered by the user in the related art, increasing the response duration of the target event. Thus, the efficiency of the target event response is reduced. Summary of the Invention

[0005] Embodiments of the present disclosure provide a method, device, equipment, and storage medium for triggering events, which can improve the response efficiency of the event bound to the target element when the user edits the elements in the collaborative drawing board.

[0006] In a first aspect, embodiments of the present disclosure provide a method for triggering events, which is applied to an electronic device; the electronic device displays an operation interface of a collaborative drawing board on the screen by running a program of the collaborative drawing board, and when an element drawn on the operation interface of the collaborative drawing board is touched by the user, the preset event of the element will be triggered; the position information of each element in the collaborative drawing board is stored through each node in a preset tree structure; the method includes:

[0007] Divide the operation interface of the collaborative drawing board into multiple quadrants according to the data structure of the quadrant quadtree;

[0008] Based on the preset tree structure, construct a quadrant quadtree; wherein, the quadrant quadtree is used to store the position information of each element in the collaborative drawing board;

[0009] When a user performs a touch operation on the operation interface, a target quadrant is determined from multiple quadrants according to the touch position of the touch operation;

[0010] Traverse each node corresponding to the target quadrant in the quadrant quadtree, determine the target element touched by the user, and trigger the event preset for the target element.

[0011] In a second aspect, an embodiment of the present disclosure provides a device for triggering an event, integrated in an electronic device; the electronic device displays an operation interface of a collaborative drawing board on the screen by running a program of the collaborative drawing board, and when an element drawn on the operation interface of the collaborative drawing board is touched by the user, the event preset for the element is triggered; the position information of each element in the collaborative drawing board is stored through each node in a preset tree structure; the device includes:

[0012] A quadrant division module, configured to divide the operation interface of the collaborative drawing board into multiple quadrants according to the data structure of the quadrant quadtree;

[0013] A data construction module, configured to construct a quadrant quadtree based on the preset tree structure; wherein, the quadrant quadtree is used to store the position information of each element in the collaborative drawing board;

[0014] A quadrant determination module, configured to determine a target quadrant from multiple quadrants according to the touch position of the touch operation when the user performs a touch operation on the operation interface;

[0015] An event hit module, traverses each node corresponding to the target quadrant in the quadrant quadtree, determines the target element touched by the user, and triggers the event preset for the target element.

[0016] In a third aspect, an embodiment of the present disclosure provides an electronic device, including: a screen, a memory, and a processor; the screen is configured to display an operation interface of a collaborative drawing board when the electronic device runs a program of the collaborative drawing board; wherein, when an element drawn on the operation interface of the collaborative drawing board is touched by the user, the event preset for the element is triggered; the position information of each element in the collaborative drawing board is stored through each node in a preset tree structure; the memory is configured to store program instructions; the processor is configured to execute the method for triggering an event described in the first aspect when running the program instructions.

[0017] In a fourth aspect, an embodiment of the present disclosure provides a storage medium storing program instructions, wherein the program instructions, when running, execute the method for triggering an event described in the first aspect.

[0018] The method, device, equipment, and storage medium for triggering an event provided by the embodiments of the present disclosure can achieve the following technical effects:

[0019] By running the program of the collaborative drawing board on the electronic device, the user can display the operation interface of the collaborative drawing board on the screen of the electronic device. Events are preset for the elements drawn by the user on the operation interface of the collaborative drawing board. Moreover, the position information of each element in the collaborative drawing board can be stored through each node of the preset tree structure. In the embodiments of the present disclosure, according to the data structure of the quadrant quadtree, the operation interface of the collaborative drawing board can be divided into multiple quadrants, and based on the preset tree structure, a quadrant quadtree for storing the position information of each element in the collaborative drawing board is constructed. When the user edits an element in the collaborative drawing board, according to the touch position of the touch operation, it is determined which quadrant the user's touch position is located in from multiple quadrants to determine the target quadrant corresponding to the touch position. Since there is a corresponding relationship between each node in the quadrant quadtree and each quadrant divided by the collaborative drawing board, after determining the target quadrant corresponding to the touch position, only the nodes corresponding to the target quadrant in the quadrant quadtree need to be traversed. In this way, in the solution of the embodiments of the present disclosure, even when there are many elements in the collaborative drawing board, it is not necessary to traverse the entire quadrant quadtree to determine the target element touched by the user and trigger the event preset for the target element. Compared with the solution of traversing all the nodes in the entire preset data structure to determine the target element touched by the user and then trigger the event bound to the target element, when there are many elements in the collaborative drawing board and the user edits the elements in the collaborative drawing board, the response efficiency of the event bound to the target element can be improved.

[0020] The above general description and the following description are only exemplary and explanatory and are not used to limit this application. Brief Description of the Drawings

[0021] One or more embodiments are exemplarily illustrated by the corresponding drawings. These exemplary illustrations and the drawings do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings are shown as similar elements. The drawings do not constitute a scale limitation, and among them:

[0022] Figure 1 is a schematic diagram of the operation interface of the collaborative drawing board provided by the embodiments of the present disclosure;

[0023] Figure 2 is a schematic diagram of the preset tree structure provided by the embodiments of the present disclosure;

[0024] Figure 3 is a flowchart of a method for triggering an event provided by the embodiments of the present disclosure;

[0025] Figure 4 is a schematic diagram of dividing quadrants based on the collaborative drawing board provided by the embodiments of the present disclosure;

[0026] Figure 5 is a correspondence diagram between each element and quadrants in the collaborative drawing board provided by the embodiments of the present disclosure;

[0027] Figure 6 It is a schematic diagram of a quadrant quadtree provided by an embodiment of the present disclosure;

[0028] Figure 7 It is a schematic diagram of a device for triggering an event provided by an embodiment of the present disclosure;

[0029] Figure 8 It is a schematic diagram of an electronic device provided by an embodiment of the present disclosure. Detailed implementation manners

[0030] In order to be able to understand the features and technical content of the embodiments of the present disclosure in more detail, the implementation of the embodiments of the present disclosure will be described in detail below with reference to the accompanying drawings. The attached drawings are only for reference and explanation purposes and are not used to limit the embodiments of the present disclosure. In the following technical description, for the sake of explanation, numerous details are provided to give a thorough understanding of the disclosed embodiments. However, one or more embodiments may still be implemented without these details. In other cases, well-known structures and devices may be shown in a simplified manner to simplify the drawings.

[0031] In the description of the embodiments of the present disclosure, the terms "first", "second", etc. in the specification and claims of the embodiments of the present disclosure and the above drawings are used to distinguish similar objects and do not have to be used to describe a specific order or sequence. It should be understood that such data may be interchanged under appropriate circumstances so as to implement the embodiments of the present disclosure described herein. In addition, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion.

[0032] Unless otherwise specified, the term "plurality" means two or more.

[0033] In the embodiments of the present disclosure, the character " / " means that the objects before and after are in an "or" relationship. For example, A / B means: A or B.

[0034] The term "and / or" is a description of the associated relationship of an object, indicating that there can be three relationships. For example, A and / or B means: A or B, or, A and B these three relationships.

[0035] The term "corresponding" may refer to an associated relationship or a binding relationship. A corresponding to B means that there is an associated relationship or a binding relationship between A and B.

[0036] Currently, users often use the collaborative drawing board running on electronic devices for drawing work. To improve the user experience in drawing on the collaborative drawing board, the elements drawn in the collaborative drawing board can be bound to the events set by the user. Specifically, the position information of the elements in the collaborative drawing board can be bound to the events set by the user. For example, if the user touches a certain element in the collaborative drawing board and hopes to perform operations such as moving, rotating, and transforming the element, then for this element, a moving event, a rotating event, a transforming event, etc. can be set, and the set events can be bound to the position information of the element. In this way, according to the coincidence of the position information of the element and the touch coordinates of the user, it can be determined whether the user touches the element, and when the user touches the element in the collaborative drawing board, the event bound to the element can be triggered to execute the event process. Thus, it is beneficial for users to edit the elements in the collaborative drawing board.

[0037] The position information of each element in the collaborative drawing board is usually stored in a tree structure. In the related art, when the user edits the elements in the collaborative drawing board, according to the position touched by the user, by traversing the position information of the elements stored in each node in the tree structure, the target element touched by the user in the collaborative drawing board can be determined, and the target event bound to the target element can be triggered.

[0038] However, in the related art, when determining the target event triggered by the user, it is necessary to traverse each node in the tree structure. In this way, when there are many elements drawn in the collaborative drawing board, the number of nodes in the tree structure used to store the position information of each element will also be large, resulting in a long time-consuming to traverse each node in the tree structure when determining the target event triggered by the user in the related art, increasing the response duration of the target event. Thus, the efficiency of the target event response is reduced.

[0039] In view of this, the embodiments of the present disclosure provide a method and device, equipment, and storage medium for triggering events. In the embodiments of the present disclosure, based on a preset tree structure and the operation interface of the collaborative drawing board, a quadtree can be constructed, and each node of the quadtree is used to store the position information of each element in the collaborative drawing board. In this way, when there are many elements in the collaborative drawing board and the user edits the elements in the collaborative drawing board, it can be determined which quadrant the touch position of the user is located in, and the nodes in that quadrant can be traversed, and then the element corresponding to the touch position can be determined, and the event bound to the element can be triggered. So that, when there are many elements drawn in the collaborative drawing board, it is only necessary to determine the quadrant corresponding to the touch position of the user and traverse the nodes in that quadrant, without having to traverse all the nodes in the tree structure, improving the response efficiency of the event bound to the target element.

[0040] The method for triggering events provided by the embodiments of the present disclosure can be applied to an electronic device. The electronic device has a screen and can be a mobile phone, a tablet computer, a smart interactive tablet, etc. The electronic device is installed with an application program of a collaborative drawing board. The application program can be a collaborative drawing board based on WebGL (Web Graphics Library). By running the application program of the collaborative drawing board installed on the electronic device, the user can display the operation interface of the collaborative drawing board on the screen of the electronic device. Elements drawn by the user on the operation interface of the collaborative drawing board are all bound with events. When the user touches an element drawn on the operation interface, the event bound to the element can be triggered.

[0041] In the embodiments of the present disclosure, the position information of each element in the collaborative drawing board is stored through each node in a preset tree structure. Specifically, a coordinate system is constructed based on the operation interface of the collaborative drawing board. The positions of each element in the collaborative drawing board are represented by coordinates in the coordinate system, and the coordinates used to represent the position information of each element are stored through each node of the preset tree structure.

[0042] Combined with Figure 1 As shown, since 7 graphics are drawn in the collaborative drawing board, that is, there are 7 elements in the collaborative drawing board, the preset tree structure used to store the position information of the 7 elements in the collaborative drawing board can be as Figure 2 shown, Figure 2 in which the root node R corresponds to the entire collaborative drawing board, and the child nodes A, B, C, D, E, F, and G correspond to the 7 elements in the collaborative drawing board respectively. Each child node is used to store the position information of the corresponding element. In addition, since Figure 1 element G also includes a sub - element g, then Figure 2 the node G in the preset tree structure in

[0043] also has a child node g.

[0044] Combined with Figure 3 As shown, the embodiments of the present disclosure provide a method for triggering events. This method can be applied to the electronic device in the above - mentioned embodiments. The method includes:

[0045] S31, divide the operation interface of the collaborative drawing board into multiple quadrants according to the data structure of the quad - tree.

[0046] S32. Based on a preset tree structure, construct a quadrant quadtree; wherein, the quadrant quadtree is used to store the position information of each element in the collaborative drawing board.

[0047] S33. When the user performs a touch operation on the operation interface, determine the target quadrant from multiple quadrants according to the empty exit position of the touch operation.

[0048] S34. Traverse each node corresponding to the target quadrant in the quadrant quadtree, determine the target element touched by the user, and trigger the event preset for the target element.

[0049] By using the method for triggering an event provided in this embodiment of the present disclosure, the user can display the operation interface of the collaborative drawing board on the screen of the electronic device by running the program of the collaborative drawing board on the electronic device, and events are preset for the elements drawn by the user on the operation interface of the collaborative drawing board. Moreover, the position information of each element in the collaborative drawing board can be stored through each node of the preset tree structure. In this embodiment of the present disclosure, according to the data structure of the quadrant quadtree, the operation interface of the collaborative drawing board can be divided into multiple quadrants, and a quadrant quadtree for storing the position information of each element in the collaborative drawing board is constructed based on the preset tree structure. When the user edits an element in the collaborative drawing board, according to the touch position of the touch operation, determine which quadrant the touch position is located in to determine the target quadrant corresponding to the touch position. Since there is a corresponding relationship between each node in the quadrant quadtree and each quadrant divided by the collaborative drawing board, after determining the target quadrant corresponding to the touch position, only the nodes corresponding to the target quadrant in the quadrant quadtree need to be traversed. In this way, in the solution of this embodiment of the present disclosure, even when there are many elements in the collaborative drawing board, it is not necessary to traverse the entire quadrant quadtree to determine the target element touched by the user and trigger the event preset for the target element. Compared with the solution of traversing all nodes in the entire preset data structure to determine the target element touched by the user and then trigger the event preset for the target element, when there are many elements in the collaborative drawing board and the user edits the elements in the collaborative drawing board, the response efficiency of the event bound to the target element can be improved.

[0050] In some embodiments, in the above step S31, the process of dividing the operation interface of the collaborative drawing board into multiple quadrants can be as Figure 4As shown. Specifically, first, divide the operation interface of the collaborative drawing board into the first quadrant, the second quadrant, the third quadrant, and the fourth quadrant. Then, according to the distribution positions of the elements in the first quadrant, divide the first quadrant into sub-quadrant 1 and sub-quadrant 2. According to the distribution positions of the elements in the second quadrant, divide the second quadrant into sub-quadrant 1 and sub-quadrant 2. According to the distribution positions of the elements in the third quadrant, divide the third quadrant into sub-quadrant 1, sub-quadrant 2, sub-quadrant 3, and sub-quadrant 4. According to the distribution positions of the elements in the fourth quadrant, divide the fourth quadrant into sub-quadrant 1 and sub-quadrant 2. In this way, each element in the collaborative drawing board corresponds to a part of the area in the operation interface of the collaborative drawing board.

[0051] Further, in the above step S32, based on the preset tree structure, construct a quadrant quadtree, including: traverse all nodes in the preset tree structure to obtain the position information of each element in the collaborative drawing board. Based on the position information of each element and the drawing board areas corresponding to each quadrant in the collaborative drawing board, determine the corresponding relationship between each element and each quadrant. According to the corresponding relationship between each element and each quadrant, store the position information of each element in the collaborative drawing board into each node of the quadrant quadtree.

[0052] After dividing the operation interface of the collaborative drawing board into multiple quadrants, it is also necessary to determine the corresponding relationship between each element in the collaborative drawing board and each quadrant to facilitate the construction of the quadrant quadtree. Since the position information of each element in the collaborative drawing board is stored in each node of the preset tree structure, by traversing the nodes in the preset tree structure, the specific position information of each element in the collaborative drawing board can be obtained. Based on the position information of each element, it can be determined which quadrant area each element in the collaborative drawing board is located in, and the corresponding relationship between each element and each quadrant can be determined one by one. In addition, the corresponding relationship between each element and each quadrant can reflect which sub-quadrant under which quadrant a certain element in the collaborative drawing board specifically corresponds to. For example, as shown in Figure 4 According to the position information of the "sector" element in the collaborative drawing board, it can be determined that the "sector" element in the collaborative drawing board is located in sub-quadrant 1 of the third quadrant.

[0053] In some embodiments, based on the corresponding relationship between each element and each quadrant, the process of storing the position information of each element in the collaborative drawing board into each node of the quadrant quadtree to construct the quadrant quadtree can be as follows:

[0054] For example, elements H, I, J, K, L, M, N, U, V, and W are drawn in the collaborative drawing board. The corresponding relationship between each element and each quadrant in the collaborative drawing board can be as Figure 5 shown. Based on the corresponding relationship between each element and each quadrant, construct as shown in Figure 6The quadrant quadtree shown. In combination with Figure 6 As shown, the root node R corresponds to the entire collaborative drawing board. The node P corresponds to the first quadrant in the collaborative drawing board and is used to store the position information of the first quadrant. The node Q corresponds to the second quadrant in the collaborative drawing board and is used to store the position information of the second quadrant. The node S corresponds to the third quadrant in the collaborative drawing board and is used to store the position information of the third quadrant. The node T corresponds to the fourth quadrant in the collaborative drawing board and is used to store the position information of the fourth quadrant. The node h is used to store the position information of the element H, the node i is used to store the position information of the element I, the node j is used to store the position information of the element J, the node k is used to store the position information of the element K, the node l is used to store the position information of the element L, the node m is used to store the position information of the element M, the node n is used to store the position information of the element N, the node u is used to store the position information of the element U, and the node w is used to store the position information of the element W. Additionally, since Figure 5 the element H in Figure 6 also includes sub-elements, then

[0055] Optionally, to facilitate the construction of the quadrant quadtree, according to the position information of each element in the collaborative drawing board, the position information of each element can be stored in each node of the quadrant quadtree by running a preset program to complete the construction of the quadrant quadtree.

[0056] For example, for a collaborative drawing board with a width of 800 and a height of 600, there is an element with a position information of (100, 100, 200, 150) in the collaborative drawing board, and there is an element with a position information of (400, 200, 150, 100). When constructing the quadrant quadtree, the code of the preset program can be as follows:

[0057]

[0058]

[0059] / / Create the root node

[0060] const rootNode = new Node(0, 0, 800, 600);

[0061] / / Create child nodes

[0062] const childNode1 = new Node(100, 100, 200, 150);

[0063] const childNode2 = new Node(400, 200, 150, 100);

[0064] / / Add the child nodes to the root node

[0065] rootNode.addChild(childNode1);

[0066] rootNode.addChild(childNode2).

[0067] Optionally, for the position information stored in the child nodes of the quadrant quadtree that have a parent node, the position information of the child element corresponding to the child node relative to the parent element can be used. For example, as shown in combination with Figure 5 and Figure 6 The position information stored in the child node o can be the position information of the child element of element H relative to element H. In this way, when the position of element H moves in the collaborative drawing board, only the position information of element H stored in the quadrant quadtree needs to be updated, that is, the position information stored in node h is updated. Since the "rectangle" child element of element H will move together with element H when the position of element H moves, the position information of the "rectangle" child element relative to element H does not change. Therefore, the position information of the "rectangle" child element does not need to be updated, that is, the position information stored in node o does not need to be updated. In this embodiment, when a certain element moves in the collaborative drawing board, only the information of the node corresponding to the element in the quadrant quadtree needs to be updated, which is beneficial to maintaining the information in the quadrant quadtree.

[0068] Further, in the above step S33, determining the target quadrant from multiple quadrants according to the touch position of the touch operation includes: obtaining the touch coordinates corresponding to the touch position. According to the touch coordinates and the drawing board areas corresponding to each quadrant in the collaborative drawing board, determine the drawing board area where the touch coordinates are located, and determine the quadrant corresponding to the drawing board area as the target quadrant.

[0069] Based on the operation interface of the collaborative drawing board, a coordinate system can be pre-constructed. When the user touches the screen, the touch position can be represented by the touch coordinates. By comparing the touch coordinates with the coordinate ranges covered by each quadrant in the collaborative drawing board, it can be determined which quadrant the touch coordinates are located in, and then the target quadrant corresponding to the user's touch position can be determined. In this embodiment, with the help of the constructed coordinate system, the target quadrant corresponding to the user's touch position can be quickly determined, thereby improving the speed of determining the target quadrant.

[0070] Further, in the above step S34, traversing each node corresponding to the target quadrant in the quadrant quadtree to determine the target element touched by the user includes: determining whether there is a target node among each node corresponding to the target quadrant; where the position information stored in the target node coincides with the touch position. If there is a target node, determine the target element touched by the user according to the node type of the target node.

[0071] The target quadrant corresponding to the user's touch position only indicates which quadrant the user touches an element in. To determine which specific element within the target quadrant the user touches, it is necessary to determine which element's position within the target quadrant coincides with the user's touch position.

[0072] In some embodiments, as shown in Figure 5 and Figure 6 assuming that the target quadrant corresponding to the user's touch position is the third quadrant, and the third quadrant includes elements L, M, N, and U. In this way, by separately determining whether the touch position coincides with elements L, M, N, and U within the third quadrant, the target element touched by the user can be determined. Specifically, the nodes corresponding to elements L, M, N, and U in the quadrant quadtree are nodes l, m, n, and u respectively. By determining whether the position information stored in each of nodes l, m, n, and u coincides with the touch position, it can be determined whether there is a target node among nodes l, m, n, and u.

[0073] In this embodiment, after determining the target node, when the target node is a branch node, that is, when the target node has child nodes, it indicates that the element corresponding to the target node in the collaborative drawing board still has sub-elements. Therefore, it is also necessary to determine the target element touched by the user according to the type of the target node. Thus, the accuracy of determining the target element is ensured, and further the accuracy of triggering events is ensured.

[0074] Optionally, determining the target element touched by the user according to the node type of the target node includes: when the target node is a leaf node, determining the element corresponding to the position information stored in the target node in the collaborative drawing board as the target element. Or, when the target node is a branch node, by traversing each child node of the target node, determining the target element touched by the user. Specifically, by traversing each child node of the target node to determine the target element touched by the user includes: screening out target child nodes from each child node of the target node; where the position information stored in the target child node coincides with the touch position. Determining the element corresponding to the position information stored in the target child node in the collaborative drawing board as the target element.

[0075] If the target node is a leaf node, it means that the target node has no child nodes, then it is determined that the position information stored in the target node is the position information of the target element. According to the position information stored in the target node, the target element at the corresponding position can be found in the collaborative drawing board. Exemplarily, as shown in Figure 5 and Figure 6 assuming that the target node is node k, then node k stores the position information of element K. According to the position information of element K, the target element K can be found in the collaborative drawing board.

[0076] If the target node is a branch node, it indicates that the target node has child nodes. In this case, it is necessary to further traverse each child node of the target node to determine which child node's stored position information coincides with the user's touch position, and then determine the target element. Exemplarily, as shown in Figure 5 and Figure 6 shown, assume that the target node is node h, and the child node of node h is node o. It is necessary to determine whether the touch position coincides with the position information stored in node o. If they coincide, then according to the position information stored in node o, find the element at the corresponding position in the collaborative drawing board as the target element.

[0077] In this embodiment, since the position information of each element in the collaborative drawing board is stored in each leaf node of the quadrant quadtree, after determining the target node and when the target node is a branch node, further traversing each leaf node in the branch node can accurately screen out the position of the target element. Thus, the accuracy in determining the target element is improved, and further the accuracy of triggering an event is ensured.

[0078] Furthermore, in the above step S34, triggering the event bound to the target element includes: calling and executing the event handler corresponding to the event. For example, when the user needs to edit the target element, by touching the target element, a move event or a rotation event bound to the target element can be triggered, and the event handler corresponding to the move event is executed, or the event handler corresponding to the rotation event is executed.

[0079] Optionally, in the embodiments of the present disclosure, considering that when the user touches the operation interface of the collaborative drawing board, it may not be for editing the elements in the collaborative drawing board, or the purpose of the user touching the collaborative drawing board is not to trigger an event of a certain element. For example, in a teaching scenario, when a teacher is explaining the teaching content drawn in the collaborative drawing board, the teacher may habitually use a finger or a stylus to touch the blank area in the collaborative drawing board. In view of this, in some embodiments, after traversing each node corresponding to the target quadrant in the quadrant quadtree, it can be determined whether there is a target node among the nodes corresponding to the target quadrant. Among them, the position information stored in the target node coincides with the touch position. If there is no target node, it is determined that the user has not touched an element in the collaborative drawing board. In this way, when the user has not touched an element in the collaborative drawing board, only the user's touch handwriting can be displayed in the collaborative drawing board, and the event bound to the element will not be triggered. Thus, the user experience when using the collaborative drawing board is improved.

[0080] As shown in Figure 7 shown, the embodiments of the present disclosure provide a device for triggering an event. This device can be integrated into the electronic device in the above embodiments. The device includes a quadrant division module 701, a data construction module 702, a quadrant determination module 703, and an event hit module 704. Among them:

[0081] The quadrant division module 701 is used to divide the operation interface of the collaborative drawing board into multiple quadrants according to the data structure of the quadrant quadtree.

[0082] The data construction module 702 is used to construct a quadrant quadtree based on a preset tree structure; wherein, the quadrant quadtree is used to store the position information of each element in the collaborative drawing board.

[0083] The quadrant determination module 703 is used to determine a target quadrant from multiple quadrants according to the touch position of a touch operation when the user performs a touch operation on the operation interface.

[0084] The event hit module 704 traverses each node corresponding to the target quadrant in the quadrant quadtree, determines the target element touched by the user, and triggers the event preset for the target element.

[0085] Optionally, the data construction module 702 is further used to: traverse all nodes in the preset tree structure to obtain the position information of each element in the collaborative drawing board. Based on the position information of each element and the drawing board area corresponding to each quadrant in the collaborative drawing board, determine the correspondence between each element and each quadrant. According to the correspondence between each element and each quadrant, store the position information of each element in the collaborative drawing board into each node of the quadrant quadtree.

[0086] Optionally, in the embodiments of the present disclosure, a coordinate system is constructed based on the operation interface of the collaborative drawing board. Correspondingly, the quadrant determination module 703 is further used to: obtain the touch coordinates corresponding to the touch position. According to the touch coordinates and the drawing board area corresponding to each quadrant in the collaborative drawing board, determine the drawing board area where the touch coordinates are located, and determine the quadrant corresponding to the drawing board area as the target quadrant.

[0087] Optionally, the event hit module 704 is further used to: determine whether there is a target node among the nodes corresponding to the target quadrant; wherein, the position information stored in the target node coincides with the touch position. If there is a target node, determine the target element touched by the user according to the node type of the target node.

[0088] Optionally, the event hit module 704 is further used to: when the target node is a leaf node, determine the element corresponding to the position information stored in the target node in the collaborative drawing board as the target element. Or, when the target node is a branch node, determine the target element touched by the user by traversing each child node of the target node.

[0089] Optionally, the event hit module 704 is further used to: screen out target child nodes from each child node of the target node; wherein, the position information stored in the target child node coincides with the touch position. Determine the element corresponding to the position information stored in the target child node in the collaborative drawing board as the target element.

[0090] Optionally, the event hit module 704 is further configured to: determine whether there is a target node among the nodes corresponding to the target quadrant; wherein, the position information stored in the target node overlaps with the touch position. If there is no target node, it is determined that the user does not touch an element in the collaborative drawing board.

[0091] The apparatus for triggering an event provided by the embodiments of the present disclosure can perform the actions of the electronic device in the above embodiments, and its implementation principle and technical effects are similar, which will not be elaborated here.

[0092] Combined with Figure 8 As shown, an electronic device 800 provided by the embodiments of the present disclosure includes a processor 801 and a memory 802. Optionally, the electronic device may further include a screen 803, a communication interface 804, and a bus 805. Among them, the processor 801, the memory 802, the screen 803, and the communication interface 804 can complete mutual communication through the bus 805. The communication interface 804 can be used for information transmission. The processor 801 can call the logic instructions in the memory 802 to execute the method for triggering an event in the above embodiments.

[0093] In addition, when the logic instructions in the above-mentioned memory 802 are implemented in the form of a software functional unit and sold or used as an independent product, they can be stored in a computer-readable storage medium.

[0094] The memory 802, as a computer-readable storage medium, can be used to store software programs and computer-executable programs, such as program instructions / modules corresponding to the methods in the embodiments of the present disclosure. The processor 801 executes functional applications and data processing by running the program instructions / modules stored in the memory 802, that is, implements the method for triggering an event in the above embodiments.

[0095] The memory 802 may include a program storage area and a data storage area. Among them, the program storage area can store an operating system and application programs required for at least one function; the data storage area can store data created according to the use of the terminal device, etc. In addition, the memory 802 may include a high-speed random access memory and may also include a non-volatile memory.

[0096] The embodiments of the present disclosure provide a storage medium storing computer-executable instructions, and the computer-executable instructions are configured to execute the method for triggering an event in the above embodiments.

[0097] The above storage medium may be a transient computer-readable storage medium or a non-transient computer-readable storage medium.

[0098] The technical solution of the embodiments of the present disclosure can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes one or more instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in the embodiments of the present disclosure. The foregoing storage medium may be a non-transitory storage medium, including: various media that can store program codes such as USB flash drives, mobile hard disks, read-only memories (ROMs), random access memories (RAMs), magnetic disks, or optical discs, or may also be a transient storage medium.

[0099] The above description and the drawings fully illustrate the embodiments of the present disclosure so that those skilled in the art can practice them. Other embodiments may include structural, logical, electrical, process, and other changes. The embodiments only represent possible variations. Unless explicitly required, the individual components and functions are optional, and the order of operations may vary. Parts and features of some embodiments may be included in or replace parts and features of other embodiments. Moreover, the terms used in this application are only for describing the embodiments and are not used to limit the claims. As used in the description of the embodiments and the claims, unless the context clearly indicates otherwise, the singular forms "a", "an", and "the" are intended to also include the plural forms. Similarly, as used in this application, the term "and / or" refers to any and all possible combinations including one or more of the associated listed items. Additionally, when used in this application, the term "comprise" and its variants "comprises" and / or "comprising", etc. mean the presence of the stated features, wholes, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components, and / or groups of these. Without further limitation, an element defined by the statement "comprising one..." does not exclude the presence of another identical element in the process, method, or device including the element. In this article, what each embodiment focuses on may be the differences from other embodiments, and the same or similar parts between the various embodiments may be referred to each other. For the methods, products, etc. disclosed in the embodiments, if they correspond to the method part disclosed in the embodiments, the relevant parts may refer to the description of the method part.

[0100] Those skilled in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are executed in a hardware or software manner can depend on the specific application and design constraints of the technical solution. The skilled person can use different methods for each specific application to implement the described functions, but such implementation should not be considered to exceed the scope of the embodiments of the present disclosure. The skilled person can clearly understand that for the convenience and conciseness of description, the specific working processes of the systems, devices, and units described above can refer to the corresponding processes in the foregoing method embodiments and will not be elaborated herein.

[0101] In the embodiments disclosed herein, the disclosed methods, products (including but not limited to devices, equipment, etc.) can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the units can be merely a logical function division, and there can be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Additionally, the displayed or discussed couplings or direct couplings or communication connections to each other can be through some interfaces. The indirect couplings or communication connections of the devices or units can be in electrical, mechanical, or other forms. The units described as separate components can be or can not be physically separated. The components displayed as units can be or can not be physical units, that is, they can be located in one place, or can be distributed to multiple network units. Some or all of the units can be selected according to actual needs to implement this embodiment. Additionally, in the embodiments of the present disclosure, the functional units can be integrated in one processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit.

[0102] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to embodiments of the present disclosure. In this regard, each block in the flowchart or block diagram may represent a module, a segment of code, or a portion thereof, which contains one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions noted in the blocks may occur in a different order than noted in the drawings. For example, two consecutive blocks may in fact be executed substantially in parallel, or they may sometimes be executed in the reverse order, depending on the functions involved. In the descriptions corresponding to the flowcharts and block diagrams in the accompanying drawings, the operations or steps corresponding to different blocks may also occur in a different order than disclosed in the description, and sometimes there is no specific order between different operations or steps. For example, two consecutive operations or steps may in fact be executed substantially in parallel, or they may sometimes be executed in the reverse order, depending on the functions involved. Each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented by a dedicated hardware-based system that performs the specified functions or actions, or can be implemented by a combination of dedicated hardware and computer instructions.

Claims

1. A method for triggering an event, characterized in that, Applied to an electronic device; the electronic device runs a program of a collaborative drawing board, displays an operation interface of the collaborative drawing board on the screen, and when an element drawn on the operation interface of the collaborative drawing board is touched by a user, a preset event of the element is triggered; The position information of each element in the collaborative drawing board is stored through each node in a preset tree structure; the method includes: Dividing the operation interface of the collaborative drawing board into multiple quadrants according to the data structure of a quadrant quadtree; Constructing a quadrant quadtree based on the preset tree structure; wherein, the quadrant quadtree is used to store the position information of each element in the collaborative drawing board; When the user performs a touch operation on the operation interface, determining a target quadrant from multiple quadrants according to the touch position of the touch operation; Traversing each node corresponding to the target quadrant in the quadrant quadtree, determining the target element touched by the user, and triggering a preset event of the target element.

2. The method according to claim 1, wherein Constructing a quadrant quadtree based on the preset tree structure includes: Traversing all nodes in the preset tree structure to obtain the position information of each element in the collaborative drawing board; Determining the corresponding relationship between each element and each quadrant based on the position information of each element and the drawing board areas corresponding to each quadrant in the collaborative drawing board; According to the corresponding relationship between each element and each quadrant, storing the position information of each element in the collaborative drawing board into each node of the quadrant quadtree.

3. The method according to claim 1, characterized in that, A coordinate system is constructed based on the operation interface of the collaborative drawing board; correspondingly, determining a target quadrant from multiple quadrants according to the touch position of the touch operation includes: Obtaining the touch coordinates corresponding to the touch position; According to the touch coordinates and the drawing board areas corresponding to each quadrant in the collaborative drawing board, determining the drawing board area where the touch coordinates are located, and determining the quadrant corresponding to the drawing board area as the target quadrant.

4. The method according to claim 1, wherein Traversing each node corresponding to the target quadrant in the quadrant quadtree to determine the target element touched by the user includes: Judging whether there is a target node among each node corresponding to the target quadrant; wherein, the position information stored in the target node coincides with the touch position; If there is a target node, determining the target element touched by the user according to the node type of the target node.

5. The method according to Claim 4, characterized in that Determining the target element touched by the user according to the node type of the target node includes: When the target node is a leaf node, determining the element in the collaborative drawing board corresponding to the position information stored in the target node as the target element; or, When the target node is a branch node, determining the target element touched by the user by traversing each child node of the target node.

6. The method according to claim 5, wherein Determining the target element touched by the user by traversing each child node of the target node includes: Selecting target child nodes from each child node of the target node; wherein, the position information stored in the target child node coincides with the touch position; Determining the element in the collaborative drawing board corresponding to the position information stored in the target child node as the target element.

7. The method according to any one of claims 1 to 6, characterized in that, After traversing each node corresponding to the target quadrant in the quadrant quadtree, the method further includes: Judging whether there is a target node among each node corresponding to the target quadrant; wherein, the position information stored in the target node coincides with the touch position; If there is no target node, determining that the user has not touched an element in the collaborative drawing board.

8. A device for triggering an event, characterized in that, Integrated in an electronic device; when the electronic device runs the program of the collaborative drawing board, the operation interface of the collaborative drawing board is displayed on the screen. When an element drawn on the operation interface of the collaborative drawing board is touched by the user, a preset event of the element will be triggered; The position information of each element in the collaborative drawing board is stored through each node in a preset tree structure; The device includes: A quadrant division module, configured to divide the operation interface of the collaborative drawing board into multiple quadrants according to the data structure of the quadrant quadtree; A data construction module, configured to construct a quadrant quadtree based on the preset tree structure; wherein, the quadrant quadtree is used to store the position information of each element in the collaborative drawing board; A quadrant determination module, configured to, when the user performs a touch operation on the operation interface, determine a target quadrant from multiple quadrants according to the touch position of the touch operation; An event hit module, traverses each node corresponding to the target quadrant in the quadrant quadtree, determines the target element touched by the user, and triggers the preset event of the target element.

9. An electronic device, characterized in that, Including: A screen, configured to display the operation interface of the collaborative drawing board when the electronic device runs the program of the collaborative drawing board; wherein, when an element drawn on the operation interface of the collaborative drawing board is touched by the user, a preset event of the element will be triggered; The position information of each element in the collaborative drawing board is stored through each node in a preset tree structure; A memory, configured to store program instructions; A processor, configured to execute the method for triggering an event according to any one of claims 1 to 7 when running the program instructions.

10. A storage medium stores program instructions, characterized in that, When the program instructions are running, execute the method for triggering an event according to any one of claims 1 to 7.