CN111506185B - Method, device, electronic equipment and storage medium for operating document - Google Patents

Method, device, electronic equipment and storage medium for operating document Download PDF

Info

Publication number
CN111506185B
CN111506185B CN201910099662.1A CN201910099662A CN111506185B CN 111506185 B CN111506185 B CN 111506185B CN 201910099662 A CN201910099662 A CN 201910099662A CN 111506185 B CN111506185 B CN 111506185B
Authority
CN
China
Prior art keywords
graph
document
determining
inflection point
judging
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910099662.1A
Other languages
Chinese (zh)
Other versions
CN111506185A (en
Inventor
陈伟彬
刘浩丽
张作兵
朱静
路晨
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Kingsoft Office Software Inc
Zhuhai Kingsoft Office Software Co Ltd
Guangzhou Kingsoft Mobile Technology Co Ltd
Original Assignee
Beijing Kingsoft Office Software Inc
Zhuhai Kingsoft Office Software Co Ltd
Guangzhou Kingsoft Mobile Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Kingsoft Office Software Inc, Zhuhai Kingsoft Office Software Co Ltd, Guangzhou Kingsoft Mobile Technology Co Ltd filed Critical Beijing Kingsoft Office Software Inc
Priority to CN201910099662.1A priority Critical patent/CN111506185B/en
Publication of CN111506185A publication Critical patent/CN111506185A/en
Application granted granted Critical
Publication of CN111506185B publication Critical patent/CN111506185B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/017Gesture based interaction, e.g. based on a set of recognized hand gestures

Abstract

The embodiment of the invention provides a method, a device, electronic equipment and a storage medium for operating a document, which are applied to a mobile terminal and comprise the following steps: acquiring a graph drawn by a user on a document display interface; judging whether the graph is a preset gesture graph or not; and if so, executing the document operation corresponding to the preset gesture graph. Therefore, when the embodiment of the invention is applied, a user does not need to press a screen for a long time to drag a selection area or search a button through a toolbar to draw a preset graph to finish the corresponding document operation, so that the operation is simple, the time is saved, and the operation efficiency is high.

Description

Method, device, electronic equipment and storage medium for operating document
Technical Field
The present invention relates to the field of document operation technologies, and in particular, to a method, an apparatus, an electronic device, and a storage medium for operating a document.
Background
At present, mobile terminals have a document processing function, and users operate on documents in the document processing process. For example: and selecting part of text content in the PDF document, triggering the selecting operation by long-time pressing of a screen by a user, determining a starting character, dragging a selection area, determining an ending character, and selecting the document content of the dragging selection area. However, the operation process is complex, the operation time of the dragging process is long, the operation speed is low, and the operation efficiency is low.
For another example: and performing bookmark adding operation on a certain page in the PDF document, requiring a user to press the document displayed on the screen for a long time, displaying function options, selecting a bookmark adding function from the function options, displaying a bookmark adding dialog box, clicking for determination, and completing the bookmark adding operation. This operation is complicated, resulting in a slow operation speed and low operation efficiency.
Therefore, the prior art has the disadvantages of complex operation on the mobile terminal document, long operation time, low operation speed and low operation efficiency.
Disclosure of Invention
The embodiment of the invention aims to provide a method, a device, electronic equipment and a storage medium for operating a document, which improve the operating efficiency. The specific technical scheme is as follows:
in a first aspect, an embodiment of the present invention provides a method for operating a document, which is applied to a mobile terminal, where the method includes:
acquiring a graph drawn by a user on a document display interface;
judging whether the graph is a preset gesture graph or not;
and if so, executing the document operation corresponding to the preset gesture graph.
Optionally, the preset gesture pattern includes: circular, line segment, quadrilateral, or opposite.
Optionally, the step of determining whether the graph is a preset gesture graph includes:
Sampling points on the graph according to a preset time interval;
calculating the slope of a virtual straight line formed by every two adjacent sampling points;
judging whether the graph is circular, line segment, quadrilateral or opposite-sign according to the change condition of the slope of the virtual straight line formed by every two sampling points and whether the graph is closed.
Optionally, the step of determining whether the graph is circular, line segment, quadrilateral or opposite-sign according to the slope of the straight line formed by every two sampling points and whether the graph is closed, includes:
a virtual rectangular frame is virtually formed by the upper, lower, left and right boundary points of the graph;
determining whether the graph is a closed graph according to the relation between the distance between the starting point and the ending point of the graph and the width of the virtual rectangular frame;
if the graph is a closed graph, judging whether the graph is a graph with the slope smoothly changing towards one trend according to the slope change condition of a virtual straight line formed by every two sampling points;
if the graph is a graph with the slope changing smoothly towards one trend, determining that the graph is circular;
if the graph is not a graph with the slope changing smoothly towards one trend, determining an inflection point in the graph according to the slope changing condition of a virtual straight line formed by every two sampling points;
Judging whether the trend of the graph at each inflection point accords with the trend rule of the quadrangle;
if the trend of the graph at each inflection point accords with the trend rule of the quadrangle, determining that the graph is the quadrangle;
if the graph is not a closed graph, judging whether the shortest side length of the rectangular frame is larger than the number of pixels corresponding to the preset line segment thickness;
if the shortest side length of the rectangular frame is larger than the number of pixels corresponding to the preset line segment roughness, determining an inflection point in the graph according to the slope change condition of each virtual straight line;
judging whether the graph has only one inflection point or not, and judging whether the trend of the graph at the inflection point accords with the trend rule of the opposite sign or not;
if only one inflection point exists in the graph and the trend of the graph at the inflection point accords with the trend rule of the opposite numbers, determining that the graph is the opposite numbers;
and if the shortest side length of the first rectangular frame is not more than the number of pixels corresponding to the preset line segment thickness, determining the graph as a line segment.
Optionally, the step of determining the inflection point in the graph according to the slope change of the virtual straight line formed by every two sampling points includes:
Judging whether the change of the slope of each adjacent virtual line is larger than 30 degrees and smaller than 180 degrees;
if the slope of the adjacent virtual straight line varies by more than 30 degrees and less than 180 degrees, the intersection point of the adjacent virtual straight line is determined as an inflection point.
Optionally, the step of executing the document operation corresponding to the preset gesture graph includes:
if the graph is circular, determining the document content from the initial character to the end character as the document content selected by the user by taking the character corresponding to the left upper inflection point of the virtual rectangular frame as the initial character and taking the character corresponding to the right lower inflection point of the virtual rectangular frame as the end character;
if the graph is a line segment, determining the document content from the initial character to the end character as the document content selected by the user by taking the character corresponding to the upper left point of the virtual rectangular frame as the initial character and taking the character corresponding to the lower right point of the virtual rectangular frame as the end character;
if the graph is a quadrilateral, screenshot is carried out on document contents in the quadrilateral;
and if the graph is a opposite sign, displaying a bookmark adding dialog box.
Optionally, before the step of obtaining the graphic drawn by the user on the document display interface, the method further includes:
Judging whether a preset gesture operation button in a document display interface is pressed by a user or not;
and if so, executing the step of acquiring the graph drawn by the user on the document display interface.
Optionally, the preset gesture operation buttons in the document display interface are displayed in a toolbar of the document display interface.
Optionally, the document is a PDF document.
In a second aspect, the present invention also discloses a device for operating a document, which is applied to a mobile terminal, and includes:
the graphic acquisition unit is used for acquiring the graphic drawn by the user on the document display interface;
the graph judging unit is used for judging whether the graph is a preset gesture graph or not;
and the document operation unit is used for executing the preset document operation corresponding to the gesture graph when the judgment result of the graph judgment module is yes.
Optionally, the preset gesture pattern includes: circular, line segment, quadrilateral, or opposite.
Optionally, the graph judging unit includes:
the sampling module is used for sampling points on the graph according to a preset time interval;
the slope calculation module is used for calculating the slope of a virtual straight line formed by every two adjacent sampling points;
And the graph judging module is used for judging whether the graph is a circle, a line segment, a quadrangle or a sign pair according to the change condition of the slope of the virtual straight line formed by every two sampling points and whether the graph is closed.
Optionally, the step of determining whether the graph is circular, line segment, quadrilateral or opposite-sign according to the slope of the straight line formed by every two sampling points and whether the graph is closed, includes:
the rectangular frame virtual module is used for virtualizing a virtual rectangular frame by using the upper, lower, left and right boundary points of the graph;
the first judging submodule is used for determining whether the graph is a closed graph according to the relation between the distance between the starting point and the ending point of the graph and the width of the virtual rectangular frame;
the second judging sub-module is used for judging whether the graph is a graph with the slope smoothly changing towards one trend according to the slope change condition of a virtual straight line formed by every two sampling points when the judging result of the first judging sub-module is yes;
the first determining submodule is used for determining that the graph is circular when the judging result of the slope changing submodule is yes;
the first inflection point determining submodule is used for determining inflection points in the graph according to the slope change condition of a virtual straight line formed by every two sampling points if the graph is not a graph with the slope smoothly changed towards one trend;
The third judging submodule is used for judging whether the trend of the graph at each inflection point accords with the trend rule of the quadrangle;
the second determining sub-module is used for determining that the graph is quadrilateral when the judging result of the third judging sub-module is yes;
a fourth judging sub-module, configured to judge, when the judging result of the first judging sub-module is no, whether the shortest length of the rectangular frame is greater than the number of pixels corresponding to the preset line segment roughness;
the second inflection point determining submodule is used for determining an inflection point in the graph according to the slope change condition of each virtual straight line when the judging result of the fourth judging submodule is yes;
a fifth judging submodule, configured to judge whether the graph has only one inflection point, and whether the trend of the graph at the inflection point accords with the trend rule of the opposite sign;
the third determining sub-module is used for determining that the graph is a opposite sign when the judging result of the fifth judging sub-module is yes;
and the fourth determination submodule is used for determining that the graph is a line segment when the judgment result of the fourth judgment submodule is yes.
Optionally, the first inflection point determining submodule specifically determines an inflection point in the graph by adopting the following steps:
Judging whether the slope of each adjacent straight line changes by more than 30 degrees and less than 180 degrees;
if the slope of the adjacent virtual straight line varies by more than 30 degrees and less than 180 degrees, the intersection point of the adjacent virtual straight line is determined as an inflection point.
Optionally, the document operation unit includes:
the first document operation module is used for determining the document content from the initial character to the end character as the document content selected by the user by taking the character corresponding to the left upper inflection point of the virtual rectangular frame as the initial character and taking the character corresponding to the right lower inflection point of the virtual rectangular frame as the end character if the graph is round;
the second document operation module is used for determining the document content from the initial character to the end character as the document content selected by the user by taking the character corresponding to the upper left point of the virtual rectangular frame as the initial character and taking the character corresponding to the lower right point of the virtual rectangular frame as the end character if the graph is a line segment;
the third document operation module is used for capturing the content of the document in the quadrangle if the graph is the quadrangle;
and the fourth document operation module is used for displaying a bookmark adding dialog box if the graph is a opposite sign.
Optionally, the device for operating the document further includes:
the button judging unit is used for judging whether a gesture operation button preset in the document display interface is pressed by a user or not before the graphic acquisition unit acquires the graphic drawn by the user on the document display interface;
and if the judgment result of the button judgment module is yes, executing the triggering of the graph acquisition unit.
Optionally, the device for operating the document further includes:
and the button display unit is used for displaying the gesture operation buttons preset in the document display interface in the toolbar of the document display interface before the button judgment unit judges whether the gesture operation buttons preset in the document display interface are pressed by a user.
Optionally, the document is a PDF document.
In a third aspect, the present invention provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory complete communication with each other through the communication bus;
a memory for storing a computer program;
and the processor is used for realizing any of the above method steps for operating the document when executing the program stored in the memory.
In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored therein, which when executed by a processor, performs any of the above-described method steps of operating on a document.
According to the method, the device, the electronic equipment and the storage medium for operating the document in the mobile terminal, provided by the embodiment of the invention, only the graph drawn by the user on the document display interface is required to be obtained, whether the graph is the preset gesture graph or not is judged, and if so, the document operation corresponding to the preset gesture graph is executed. Therefore, when the embodiment of the invention is applied, a user does not need to press a screen for a long time to drag a selection area or search a button through a toolbar, and the corresponding document operation can be completed by drawing a preset graph, so that the operation is simple, the operation time is saved, and the operation efficiency is improved.
Of course, it is not necessary for any one product or method of practicing the invention to achieve all of the advantages set forth above at the same time.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, it being obvious that the drawings in the following description are only some embodiments of the invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of a method of operating on a document provided by an embodiment of the present invention;
FIG. 2 is another flow chart of a method of operating on a document provided by an embodiment of the present invention;
FIG. 3 is a flowchart showing a step S205 in the embodiment shown in FIG. 2;
FIG. 4 is a schematic diagram of an interface to which embodiments of the present invention are applied;
FIG. 5 is a schematic diagram of another interface to which embodiments of the present invention are applied;
FIG. 6 is a schematic diagram of yet another interface to which embodiments of the present invention are applied;
FIG. 7 is a schematic diagram of a device for operating on a document according to an embodiment of the present invention;
fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The method for operating the document provided by the embodiment of the invention can be applied to any electronic equipment needing to operate the document, and is not particularly limited. For convenience of description, the following is referred to as an electronic device.
The embodiment of the invention provides a method for operating a document, as shown in fig. 1, the specific processing flow of the method comprises the following steps:
step S101, a graph drawn by a user on a document display interface is obtained.
In one embodiment, the electronic device obtains a graphic drawn by a user on the document display interface, and records a track of the graphic by recording pixels drawn by the user.
Alternatively, the document may be a PDF document.
Step S102, judging whether the graph is a preset gesture graph. If yes, the graph is a preset gesture graph, and step S103 is executed; if the result of the determination is no, that is, the graph is not the preset gesture graph, step S104 is executed.
In one embodiment, the electronic device may obtain a preset gesture pattern in advance, where the preset gesture pattern may include: circular, line segment, quadrilateral, or opposite. The preset gesture patterns can include, but are not limited to, gesture patterns with the above pattern shapes, and gestures with different pattern shapes can be corresponding to different functions according to actual conditions.
Therefore, the electronic equipment can judge whether the graph drawn by the user is the preset gesture graph according to the graph drawn by the user on the document display interface and the preset gesture graph.
Step S103, executing a preset document operation corresponding to the gesture graph.
In one embodiment, the electronic device may execute the document operation corresponding to the preset gesture pattern according to which gesture pattern the user draws.
Specifically, if the gesture graph is a circle or a line segment, executing corresponding document content selection operation; if the image is quadrilateral, executing corresponding screenshot operation; and if the number is the opposite number, executing the corresponding operation of adding the bookmark.
Step S104, determining the graph as an invalid graph.
In one embodiment, the graphics drawn by the user are invalid graphics, a prompt box with the invalid graphics can be output to the user, and an effective gesture can be displayed in the prompt box to remind the user of which graphics the effective gesture includes.
The method for operating the document at the mobile terminal provided by the embodiment of the invention only needs to acquire the graph drawn by the user on the document display interface, judges whether the graph is a preset gesture graph, and if so, executes the document operation corresponding to the preset gesture graph. Therefore, when the embodiment of the invention is applied, a user does not need to press a screen for a long time to drag a selection area or search a button through a toolbar, and the corresponding document operation can be completed by drawing a preset graph, so that the operation is simple, the operation time is saved, and the operation efficiency is improved.
Another flowchart of a method for operating a document according to an embodiment of the present invention, as shown in FIG. 2, includes:
step S201, it is determined whether a gesture operation button preset in the document display interface is pressed by the user.
In one embodiment, the electronic device may determine whether a gesture operation button preset in the document display interface is pressed by the user, where the gesture operation button preset in the document display interface is displayed in a toolbar of the document display interface, and the gesture operation button may be preset.
If yes, the button is pressed by the user, and step S202 is executed; if the judgment result is negative, namely the button is not pressed by the user, the gesture mode is not entered.
Step S202, a graph drawn by a user on a document display interface is obtained.
In practical application, step S202 may be the same as step S101.
Step S203, sampling points on the graph according to preset time intervals.
In one embodiment, the electronic device may sample the points on the graph, for example, may preset every 1 millisecond (ms), and sample the points on the graph once, so as to obtain a series of sampling points arranged according to the sampling time sequence.
In step S204, the slope of the virtual straight line formed by each two adjacent sampling points is calculated.
In one embodiment, the electronic device may virtually draw a virtual line between every two adjacent sampling points to obtain a series of virtual lines arranged according to the sampling time sequence, and calculate the slopes of all the virtual lines to obtain a series of slopes of the virtual lines arranged according to the sampling time sequence.
Step S205, judging whether the graph is a circle, a line segment, a quadrangle or a pair of numbers according to the change condition of the slope of the virtual straight line formed by every two sampling points and whether the graph is closed. If the judgment result is yes, that is, the graph is a circle, a line segment, a quadrangle or a sign pair, executing step S206; if the judgment result is no, that is, the graph is not a circle, a line segment, a quadrangle, or a pair of numbers, step S207 is performed.
Step S206, executing the preset document operation corresponding to the gesture graph.
Step S207, determining the graph as an invalid graph.
According to the method for operating the document at the mobile terminal, which is provided by the embodiment of the invention, the screen is not required to be pressed for a long time, the selected area is dragged or a certain button is searched through the toolbar, the operation is simple, the operation time is saved, and the operation efficiency is improved. And through pressing the gesture operation button of predetermineeing, get into gesture mode, shielded other gesture operations, such as the gesture corresponding operation such as upper scratch, lower scratch to avoided the conflict with other gestures, the gesture mode of getting into after can be through drawing the gesture graph of predetermineeing alright operate the document, easy operation.
Specifically, for a specific implementation procedure of step S205 in the embodiment shown in fig. 2, reference may be made to fig. 3, where fig. 3 is a specific flowchart of step S205 in the embodiment shown in fig. 2, including:
in step S301, a virtual rectangular frame is virtually formed by using the boundary points of the upper, lower, left and right sides of the graph.
Step S302, judging whether the graph is a closed graph according to the relation between the distance between the starting point and the ending point of the graph and the width of the virtual rectangular frame.
In one embodiment, whether the graph is a closed graph may be determined according to a relationship between a distance between a start point and an end point of the graph and a width of the virtual rectangular frame. In practice, it may be arranged that the closed pattern is determined when the distance between the start point and the end point of the pattern is less than half the width of the virtual rectangular frame or 1/3 or less. That is, if the start point and the end point coincide, or the distance between the start point and the end point is small, it can be determined that it is a closed pattern.
If the judgment result is yes, namely, the graph is determined to be a closed graph, a step S303 is executed; if the judgment result is no, that is, the graph is not a closed graph, step S309 is performed.
Step S303, judging whether the graph is a graph with the slope smoothly changing to one trend according to the slope change condition of the virtual straight line formed by every two sampling points.
In one embodiment, according to the slope change condition of the virtual straight line formed by every two sampling points, whether the graph is a graph with the slope smoothly varying towards a trend is judged, and a fault tolerance angle can be set, for example: 5-10 degrees, when the slope of adjacent virtual lines varies less than the fault tolerance angle, the graph is considered to be a smooth variation like a trend. I.e. the larger the fault tolerance angle, the lower the circular requirement.
If yes, that is, the graph is a graph with a slope smoothly varying to a trend, executing step S304; if the result of the determination is no, that is, the graph is not a graph in which the slope smoothly varies toward one trend, step S305 is performed.
Step S304, determining that the graph is circular.
Step S305, determining inflection points in the graph according to the slope change condition of the virtual straight line formed by every two sampling points.
In one embodiment, the step may determine whether the slope of each adjacent virtual line changes by more than 30 degrees and less than 180 degrees, and if the slope of each two adjacent virtual lines changes by more than 30 degrees and less than 180 degrees, determine the intersection point of the adjacent virtual lines as an inflection point. And similarly, judging the change of the slopes of other adjacent virtual lines, and determining the inflection point in the graph. Of course, other angles may be preset, for example: whether the slope of each adjacent straight line changes by more than 45 degrees and less than 180 degrees is judged, and if the slope of each adjacent straight line changes by more than 45 degrees and less than 180 degrees, an inflection point is determined here, namely the angle is preset.
Step S306, judging whether the trend of the graph at each inflection point accords with the trend rule of the quadrangle.
In one embodiment, the trend rule of the quadrangle at each inflection point may be preset to be from left to right, lower to left, upper or upper to lower, right, upper to left. The trend rule of the quadrangle at each inflection point can be preset.
If the judgment result is yes, that is, the trend of the graph at each inflection point accords with the trend rule of the quadrangle, executing step S307; if the judgment result is no, that is, the trend of the graph at each inflection point does not accord with the trend rule of the quadrangle, step S308 is executed.
In step S307, the graph is determined to be a quadrangle.
In step S308, the pattern is determined as an invalid pattern.
Step S309, determining whether the shortest length of the rectangular frame is greater than the number of pixels corresponding to the preset line segment thickness.
In one embodiment, the number of pixels corresponding to the thickness of the line segment may be preset to be 10 pixels, and may be changed according to the actual situation.
If the judgment result is yes, that is, the shortest side length of the rectangular frame is larger than the number of pixels corresponding to the preset line segment thickness, executing step S310; if the determination result is no, that is, the shortest side length of the first rectangular frame is not greater than the number of pixels corresponding to the preset line segment thickness, step S313 is executed.
Step S310, determining an inflection point in the graph.
In practical application, step S310 may determine the inflection points in the graph in the same manner as step S305, and in this step, after determining the inflection points, the number of inflection points may be recorded.
Step S311, judging whether the graph has only one inflection point, and judging whether the trend of the graph at the inflection point accords with the trend rule of the opposite shape.
In one embodiment, the pattern trend rule may be that the pattern trend is first inclined downward with a first slope, changed in direction at the inflection point, and then inclined upward with a second slope.
If the judgment result is yes, namely, the graph has only one inflection point, and the trend of the graph at the inflection point accords with the trend rule of the opposite sign, step S312 is executed; if the judgment result is no, that is, there is not only one inflection point in the graph, or the trend of the graph at the inflection point does not accord with the trend rule of the pattern, step S308 is executed.
Step S312, determining the graph as a pair of numbers.
Step S313, determining the graph as a line segment.
In practical application, corresponding to fig. 3, step S206 in the embodiment shown in fig. 2 may be implemented as follows:
If the graph is circular, the character corresponding to the left inflection point of the virtual rectangular frame virtualized in step S301 is taken as a start character, the character corresponding to the right inflection point of the virtual rectangular frame is taken as an end character, and the document content from the start character to the end character is determined as the document content selected by the user.
FIG. 4 is a schematic diagram of an interface according to an embodiment of the invention. As shown in the left-hand diagram of FIG. 4, in one embodiment, a user draws a closed shape in a document. The closed graph is determined to be circular, corresponds to a circular gesture, and executes the function of selecting text by a box corresponding to the circular gesture. A rectangular frame is virtually formed by the boundary points of the upper, lower, left and right of the graph drawn by the user; the method comprises the steps of taking a character corresponding to the left upper inflection point of the virtual rectangular frame as a starting character, taking a character corresponding to the right lower inflection point of the virtual rectangular frame as an ending character, and determining the document content from the starting character to the ending character as the document content selected by a user; the final selected document content is displayed with the next operation options such as copying, as shown in the right diagram of fig. 4.
If the graph is a line segment, the character corresponding to the upper left point of the virtual rectangular frame virtualized in step S301 is taken as a start character, the character corresponding to the lower right point of the virtual rectangular frame is taken as an end character, and the document content from the start character to the end character is determined as the document content selected by the user.
FIG. 5 is a schematic diagram of another interface according to an embodiment of the present invention.
As shown in the left diagram of FIG. 5, in one embodiment, a user draws a line segment on a document, is determined to be a line segment gesture, and performs the function of framing text corresponding to the line segment gesture. Taking the character corresponding to the upper left point of the virtual rectangular frame which is virtually obtained in the step S301 as a starting character, taking the character corresponding to the lower right point of the virtual rectangular frame as an ending character, and determining the document content from the starting character to the ending character as the document content selected by the user; the final selected document content is displayed with the next operation options such as copying, as shown in the right diagram of fig. 5.
The line segment gesture is mainly used for solving the problem that a user wants to select one or more lines of texts, namely, when the text content to be selected by the user is less, a circular graph is not easy to draw, and at the moment, the function operation of selecting the texts by the line segment graph drawing mode is more convenient.
The function of selecting text by a frame corresponding to a circular or line gesture is executed, and the problem that positioning is inaccurate due to slow dragging operation when a magnifying glass shields a content viewing area and a shielding part is not seen clearly under the condition that a screen of a mobile terminal has a fixed size in the prior art is solved.
If the graph is a quadrilateral, screenshot is carried out on document contents in the quadrilateral;
and if the graph is a opposite sign, displaying a bookmark adding dialog box.
Fig. 6 is a schematic diagram of another interface according to an embodiment of the present invention.
As shown in the left-hand diagram of FIG. 6, in one embodiment, a user draws a check number and displays an add bookmark dialog.
As can be seen from fig. 4 to fig. 6, the embodiment of the invention can realize the operation of the document by simple gestures, and has simple and convenient operation and high efficiency.
The structure schematic diagram of the device for operating the document provided by the embodiment of the invention is shown in fig. 7.
A graphic acquisition unit 701, configured to acquire a graphic drawn by a user on a document display interface.
The graph judging unit 702 is configured to judge whether the graph is a preset gesture graph.
And a document operation unit 703, configured to execute a preset document operation corresponding to the gesture pattern when the judgment result of the pattern judgment module is yes.
Optionally, the preset gesture pattern includes: circular, line segment, quadrilateral, or opposite.
Optionally, the graph judging unit includes:
the sampling module is used for sampling points on the graph according to a preset time interval;
The slope calculation module is used for calculating the slope of a virtual straight line formed by every two adjacent sampling points;
and the graph judging module is used for judging whether the graph is a circle, a line segment, a quadrangle or a sign pair according to the change condition of the slope of the virtual straight line formed by every two sampling points and whether the graph is closed.
Optionally, the step of determining whether the graph is circular, line segment, quadrilateral or opposite-sign according to the slope of the straight line formed by every two sampling points and whether the graph is closed, includes:
the rectangular frame virtual module is used for virtualizing a virtual rectangular frame by using the upper, lower, left and right boundary points of the graph;
the first judging submodule is used for determining whether the graph is a closed graph according to the relation between the distance between the starting point and the ending point of the graph and the width of the virtual rectangular frame;
the second judging sub-module is used for judging whether the graph is a graph with the slope smoothly changing towards one trend according to the slope change condition of a virtual straight line formed by every two sampling points when the judging result of the first judging sub-module is yes;
the first determining submodule is used for determining that the graph is circular when the judging result of the slope changing submodule is yes;
The first inflection point determining submodule is used for determining inflection points in the graph according to the slope change condition of a virtual straight line formed by every two sampling points if the graph is not a graph with the slope smoothly changed towards one trend;
the third judging submodule is used for judging whether the trend of the graph at each inflection point accords with the trend rule of the quadrangle;
the second determining sub-module is used for determining that the graph is quadrilateral when the judging result of the third judging sub-module is yes;
a fourth judging sub-module, configured to judge, when the judging result of the first judging sub-module is no, whether the shortest length of the rectangular frame is greater than the number of pixels corresponding to the preset line segment roughness;
the second inflection point determining submodule is used for determining an inflection point in the graph according to the slope change condition of each virtual straight line when the judging result of the fourth judging submodule is yes;
a fifth judging submodule, configured to judge whether the graph has only one inflection point, and whether the trend of the graph at the inflection point accords with the trend rule of the opposite sign;
the third determining sub-module is used for determining that the graph is a opposite sign when the judging result of the fifth judging sub-module is yes;
And the fourth determination submodule is used for determining that the graph is a line segment when the judgment result of the fourth judgment submodule is yes.
Optionally, the first inflection point determining submodule specifically determines an inflection point in the graph by adopting the following steps:
judging whether the slope of each adjacent straight line changes by more than 30 degrees and less than 180 degrees;
if the slope of the adjacent virtual straight line varies by more than 30 degrees and less than 180 degrees, the intersection point of the adjacent virtual straight line is determined as an inflection point.
Optionally, the document operation unit includes:
the first document operation module is used for determining the document content from the initial character to the end character as the document content selected by the user by taking the character corresponding to the left upper inflection point of the virtual rectangular frame as the initial character and taking the character corresponding to the right lower inflection point of the virtual rectangular frame as the end character if the graph is round;
the second document operation module is used for determining the document content from the initial character to the end character as the document content selected by the user by taking the character corresponding to the upper left point of the virtual rectangular frame as the initial character and taking the character corresponding to the lower right point of the virtual rectangular frame as the end character if the graph is a line segment;
The third document operation module is used for capturing the content of the document in the quadrangle if the graph is the quadrangle;
and the fourth document operation module is used for displaying a bookmark adding dialog box if the graph is a opposite sign.
Optionally, the device for operating the document further includes:
the button judging unit is used for judging whether a gesture operation button preset in the document display interface is pressed by a user or not before the graphic acquisition unit acquires the graphic drawn by the user on the document display interface;
and if the judgment result of the button judgment module is yes, executing the triggering of the graph acquisition unit.
Optionally, the device for operating the document further includes:
and the button display unit is used for displaying the gesture operation buttons preset in the document display interface in the toolbar of the document display interface before the button judgment unit judges whether the gesture operation buttons preset in the document display interface are pressed by a user.
Optionally, the document is a PDF document.
The device for operating the document at the mobile terminal provided by the embodiment of the invention only needs the graphic acquisition unit to acquire the graphic drawn by the user on the document display interface, the graphic judgment unit judges whether the graphic is a preset gesture graphic or not, and if so, the graphic operation unit executes the step of the document operation corresponding to the preset gesture graphic. When a user operates the document, the user does not need to press the screen for a long time, drags the selection area or searches a certain button through the toolbar, and the corresponding document operation can be completed by drawing a preset graph, so that the operation is simple, the operation time is saved, and the operation efficiency is improved.
The embodiment of the present invention further provides an electronic device, as shown in fig. 8, including a processor 801, a communication interface 802, a memory 803, and a communication bus 804, where the processor 801, the communication interface 802, and the memory 803 complete communication with each other through the communication bus 804,
a memory 803 for storing a computer program;
the processor 801, when executing the program stored in the memory 803, implements the following steps:
acquiring a graph drawn by a user on a document display interface;
judging whether the graph is a preset gesture graph or not;
and if so, executing the document operation corresponding to the preset gesture graph.
The communication bus mentioned above for the electronic devices may be a peripheral component interconnect standard (Peripheral Component Interconnect, PCI) bus or an extended industry standard architecture (Extended Industry Standard Architecture, EISA) bus, etc. The communication bus may be classified as an address bus, a data bus, a control bus, or the like. For ease of illustration, the figures are shown with only one bold line, but not with only one bus or one type of bus.
The communication interface is used for communication between the electronic device and other devices.
The Memory may include random access Memory (Random Access Memory, RAM) or may include Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the aforementioned processor.
The processor may be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU), a network processor (Network Processor, NP), etc.; but also digital signal processors (Digital Signal Processing, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), field programmable gate arrays (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
In yet another embodiment of the present invention, there is also provided a computer readable storage medium having stored therein a computer program which when executed by a processor performs the steps of any of the methods of operating on a document described above.
In yet another embodiment of the present invention, there is also provided a computer program product containing instructions that, when run on a computer, cause the computer to perform the method of any of the above embodiments for operating on a document.
In the above embodiments, it may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, produces a flow or function in accordance with embodiments of the present invention, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions may be stored in or transmitted from one computer-readable storage medium to another, for example, by wired (e.g., coaxial cable, optical fiber, digital Subscriber Line (DSL)), or wireless (e.g., infrared, wireless, microwave, etc.). The computer readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that contains an integration of one or more available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid State Disk (SSD)), etc.
It is noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
In this specification, each embodiment is described in a related manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments. In particular, for embodiments of the apparatus, electronic device, computer readable storage medium, and computer program product, which are substantially similar to method embodiments, the description is relatively simple, and reference is made to the section of the method embodiments for relevance.
The foregoing description is only of the preferred embodiments of the present invention and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.

Claims (14)

1. A method for operating a document, applied to a mobile terminal, comprising:
acquiring a graph drawn by a user on a document display interface;
judging whether the graph is a preset gesture graph or not, wherein the preset gesture graph comprises: round, line segment, quadrilateral or opposite shape;
if yes, executing document operation corresponding to the preset gesture graph;
the step of judging whether the graph is a preset gesture graph comprises the following steps:
sampling points on the graph according to a preset time interval;
calculating the slope of a virtual straight line formed by every two adjacent sampling points;
a virtual rectangular frame is virtually formed by the upper, lower, left and right boundary points of the graph;
determining whether the graph is a closed graph according to the relation between the distance between the starting point and the ending point of the graph and the width of the virtual rectangular frame;
if the graph is a closed graph, judging whether the graph is a graph with the slope smoothly changing towards one trend according to the slope change condition of a virtual straight line formed by every two sampling points;
If the graph is a graph with the slope changing smoothly towards one trend, determining that the graph is circular;
if the graph is not a graph with the slope changing smoothly towards one trend, determining an inflection point in the graph according to the slope changing condition of a virtual straight line formed by every two sampling points;
judging whether the trend of the graph at each inflection point accords with the trend rule of the quadrangle;
if the trend of the graph at each inflection point accords with the trend rule of the quadrangle, determining that the graph is the quadrangle;
if the graph is not a closed graph, judging whether the shortest side length of the virtual rectangular frame is larger than the number of pixels corresponding to the preset line segment roughness;
if the shortest side length of the virtual rectangular frame is larger than the number of pixels corresponding to the preset line segment roughness, determining an inflection point in the graph according to the slope change condition of each virtual straight line;
judging whether the graph has only one inflection point or not, and judging whether the trend of the graph at the inflection point accords with the trend rule of the opposite sign or not;
if only one inflection point exists in the graph and the trend of the graph at the inflection point accords with the trend rule of the opposite numbers, determining that the graph is the opposite numbers;
And if the shortest side length of the virtual rectangular frame is not greater than the number of pixels corresponding to the preset line segment thickness, determining the graph as a line segment.
2. The method of claim 1, wherein the step of determining the inflection point in the graph based on the slope change of the virtual straight line formed by each two sampling points comprises:
judging whether the change of the slope of each adjacent virtual line is larger than 30 degrees and smaller than 180 degrees;
if the slope of the adjacent virtual straight line varies by more than 30 degrees and less than 180 degrees, the intersection point of the adjacent virtual straight line is determined as an inflection point.
3. The method according to claim 1, wherein the step of performing a document operation corresponding to the preset gesture pattern includes:
if the graph is circular, determining the document content from the initial character to the end character as the document content selected by the user by taking the character corresponding to the left upper inflection point of the virtual rectangular frame as the initial character and taking the character corresponding to the right lower inflection point of the virtual rectangular frame as the end character;
if the graph is a line segment, determining the document content from the initial character to the end character as the document content selected by the user by taking the character corresponding to the upper left point of the virtual rectangular frame as the initial character and taking the character corresponding to the lower right point of the virtual rectangular frame as the end character;
If the graph is a quadrilateral, screenshot is carried out on document contents in the quadrilateral;
and if the graph is a opposite sign, displaying a bookmark adding dialog box.
4. The method of claim 1, further comprising, prior to the step of capturing the user's graphic drawn on the document display interface:
judging whether a preset gesture operation button in a document display interface is pressed by a user or not;
and if so, executing the step of acquiring the graph drawn by the user on the document display interface.
5. The method of claim 4, wherein the preset gesture operation buttons in the document display interface are displayed in a toolbar of the document display interface.
6. The method of any one of claims 1-5, wherein the document is a PDF document.
7. An apparatus for operating a document, applied to a mobile terminal, comprising:
the graphic acquisition unit is used for acquiring the graphic drawn by the user on the document display interface;
the graphic judgment unit is used for judging whether the graphic is a preset gesture graphic or not, and the preset gesture graphic comprises: round, line segment, quadrilateral or opposite shape;
The document operation unit is used for executing preset document operation corresponding to the gesture graph when the judgment result of the graph judgment module is yes;
the graphic judgment unit includes:
the sampling module is used for sampling points on the graph according to a preset time interval;
the slope calculation module is used for calculating the slope of a virtual straight line formed by every two adjacent sampling points;
a graphics judgment module comprising:
the rectangular frame virtual module is used for virtualizing a virtual rectangular frame by using the upper, lower, left and right boundary points of the graph;
the first judging submodule is used for determining whether the graph is a closed graph according to the relation between the distance between the starting point and the ending point of the graph and the width of the virtual rectangular frame;
the second judging sub-module is used for judging whether the graph is a graph with the slope smoothly changing towards one trend according to the slope change condition of a virtual straight line formed by every two sampling points when the judging result of the first judging sub-module is yes;
the first determining submodule is used for determining that the graph is circular when the judging result of the slope changing submodule is yes;
the first inflection point determining submodule is used for determining inflection points in the graph according to the slope change condition of a virtual straight line formed by every two sampling points if the graph is not a graph with the slope smoothly changed towards one trend;
The third judging submodule is used for judging whether the trend of the graph at each inflection point accords with the trend rule of the quadrangle;
the second determining sub-module is used for determining that the graph is quadrilateral when the judging result of the third judging sub-module is yes;
a fourth judging sub-module, configured to judge whether the shortest length of the virtual rectangular frame is greater than the number of pixels corresponding to the preset line segment thickness when the judging result of the first judging sub-module is no;
the second inflection point determining submodule is used for determining an inflection point in the graph according to the slope change condition of each virtual straight line when the judging result of the fourth judging submodule is yes;
a fifth judging submodule, configured to judge whether the graph has only one inflection point, and whether the trend of the graph at the inflection point accords with the trend rule of the opposite sign;
the third determining sub-module is used for determining that the graph is a opposite sign when the judging result of the fifth judging sub-module is yes;
and the fourth determination submodule is used for determining that the graph is a line segment when the judgment result of the fourth judgment submodule is yes.
8. The apparatus of claim 7, wherein the first inflection point determining submodule determines the inflection point in the graph by:
Judging whether the slope of each adjacent straight line changes by more than 30 degrees and less than 180 degrees;
if the slope of the adjacent virtual straight line varies by more than 30 degrees and less than 180 degrees, the intersection point of the adjacent virtual straight line is determined as an inflection point.
9. The apparatus according to claim 7, wherein the document operation unit includes:
the first document operation module is used for determining the document content from the initial character to the end character as the document content selected by the user by taking the character corresponding to the left upper inflection point of the virtual rectangular frame as the initial character and taking the character corresponding to the right lower inflection point of the virtual rectangular frame as the end character if the graph is round;
the second document operation module is used for determining the document content from the initial character to the end character as the document content selected by the user by taking the character corresponding to the upper left point of the virtual rectangular frame as the initial character and taking the character corresponding to the lower right point of the virtual rectangular frame as the end character if the graph is a line segment;
the third document operation module is used for capturing the content of the document in the quadrangle if the graph is the quadrangle;
and the fourth document operation module is used for displaying a bookmark adding dialog box if the graph is a opposite sign.
10. The apparatus as recited in claim 7, further comprising:
the button judging unit is used for judging whether a gesture operation button preset in the document display interface is pressed by a user or not before the graphic acquisition unit acquires the graphic drawn by the user on the document display interface;
and if the judgment result of the button judgment module is yes, executing the triggering of the graph acquisition unit.
11. The apparatus as recited in claim 10, further comprising:
and the button display unit is used for displaying the gesture operation buttons preset in the document display interface in the toolbar of the document display interface before the button judgment unit judges whether the gesture operation buttons preset in the document display interface are pressed by a user.
12. The apparatus according to any one of claims 7 to 11, wherein the document is a PDF document.
13. The electronic equipment is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are communicated with each other through the communication bus;
a memory for storing a computer program;
a processor for implementing the steps of the method of any one of claims 1-6 when executing a program stored on a memory.
14. A computer readable storage medium, characterized in that the computer readable storage medium has stored therein a computer program which, when executed by a processor, implements the steps of the method of any of claims 1-6.
CN201910099662.1A 2019-01-31 2019-01-31 Method, device, electronic equipment and storage medium for operating document Active CN111506185B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910099662.1A CN111506185B (en) 2019-01-31 2019-01-31 Method, device, electronic equipment and storage medium for operating document

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910099662.1A CN111506185B (en) 2019-01-31 2019-01-31 Method, device, electronic equipment and storage medium for operating document

Publications (2)

Publication Number Publication Date
CN111506185A CN111506185A (en) 2020-08-07
CN111506185B true CN111506185B (en) 2023-09-29

Family

ID=71875661

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910099662.1A Active CN111506185B (en) 2019-01-31 2019-01-31 Method, device, electronic equipment and storage medium for operating document

Country Status (1)

Country Link
CN (1) CN111506185B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112748842A (en) * 2020-12-31 2021-05-04 维沃移动通信有限公司 Text selection method and device

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH09311855A (en) * 1996-05-24 1997-12-02 Matsushita Electric Ind Co Ltd Handwritten data editing device, and method therefor
JP2004046359A (en) * 2002-07-09 2004-02-12 Sharp Corp Handwriting input device and method, handwriting input program, and program recording medium
CN101667074A (en) * 2008-09-03 2010-03-10 联想(北京)有限公司 Device using graphic input to complete operation and method thereof
CN104360808A (en) * 2014-12-04 2015-02-18 李方 Method and device for editing documents by using symbolic gesture instructions
CN104915131A (en) * 2014-03-11 2015-09-16 珠海金山办公软件有限公司 Method and apparatus for turning pages of electronic document
JP2015176522A (en) * 2014-03-18 2015-10-05 富士ゼロックス株式会社 Information processing device and program
WO2017114002A1 (en) * 2015-12-29 2017-07-06 清华大学 Device and method for inputting one-dimensional handwritten text
CN108845747A (en) * 2018-04-23 2018-11-20 普联技术有限公司 A kind of Touch-control error prevention method, apparatus and terminal device

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7098896B2 (en) * 2003-01-16 2006-08-29 Forword Input Inc. System and method for continuous stroke word-based text input
JP5489377B1 (en) * 2012-12-28 2014-05-14 パナソニック株式会社 Display device, display method, and display program

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH09311855A (en) * 1996-05-24 1997-12-02 Matsushita Electric Ind Co Ltd Handwritten data editing device, and method therefor
JP2004046359A (en) * 2002-07-09 2004-02-12 Sharp Corp Handwriting input device and method, handwriting input program, and program recording medium
CN101667074A (en) * 2008-09-03 2010-03-10 联想(北京)有限公司 Device using graphic input to complete operation and method thereof
CN104915131A (en) * 2014-03-11 2015-09-16 珠海金山办公软件有限公司 Method and apparatus for turning pages of electronic document
JP2015176522A (en) * 2014-03-18 2015-10-05 富士ゼロックス株式会社 Information processing device and program
CN104360808A (en) * 2014-12-04 2015-02-18 李方 Method and device for editing documents by using symbolic gesture instructions
WO2017114002A1 (en) * 2015-12-29 2017-07-06 清华大学 Device and method for inputting one-dimensional handwritten text
CN108845747A (en) * 2018-04-23 2018-11-20 普联技术有限公司 A kind of Touch-control error prevention method, apparatus and terminal device

Also Published As

Publication number Publication date
CN111506185A (en) 2020-08-07

Similar Documents

Publication Publication Date Title
RU2631770C2 (en) Method and device for return to previously viewed page control
TWI611338B (en) Method for zooming screen and electronic apparatus and computer program product using the same
US9569004B2 (en) Swipe toolbar to switch tabs
CN108553894B (en) Display control method and device, electronic equipment and storage medium
EP4177783A1 (en) Method and apparatus for browsing table in document, and electronic device and storage medium
KR20150089074A (en) Using clamping to modify scrolling
US20130174033A1 (en) HTML5 Selector for Web Page Content Selection
CN113536173B (en) Page processing method and device, electronic equipment and readable storage medium
CN109240591B (en) Interface display method and device
US11899918B2 (en) Method, apparatus, electronic device and storage medium for invoking touch screen magnifier
CN111506185B (en) Method, device, electronic equipment and storage medium for operating document
US20140351745A1 (en) Content navigation having a selection function and visual indicator thereof
KR101294458B1 (en) Apparatus and method of inputting text in mobile device
US20170010805A1 (en) Character Input Method and Electronic Device
CN112987992B (en) Navigation element display method and device and electronic equipment
CN112667931B (en) Webpage collecting method, electronic equipment and storage medium
TWI489370B (en) System and method for rendering widget
CN113311982A (en) Information selection method and device
CN108595569B (en) File path copying method, file path copying device and mobile terminal
CN106095734B (en) Text display method and device
CN112306336A (en) Document content display method and device
WO2018010315A1 (en) Desktop page management method and device
CN115033148B (en) Document display method, device, electronic equipment and storage medium
CN110928470B (en) Signature box display method and device, electronic equipment and storage medium
CN111815340B (en) Popularization information determination method, device, equipment and readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant