CN114115686A - Method and device for separating hand, stylus and touch in H5 webpage handwriting application and storage medium - Google Patents
Method and device for separating hand, stylus and touch in H5 webpage handwriting application and storage medium Download PDFInfo
- Publication number
- CN114115686A CN114115686A CN202111230720.3A CN202111230720A CN114115686A CN 114115686 A CN114115686 A CN 114115686A CN 202111230720 A CN202111230720 A CN 202111230720A CN 114115686 A CN114115686 A CN 114115686A
- Authority
- CN
- China
- Prior art keywords
- touch
- handwriting
- pressure
- value
- pstart
- 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.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 35
- 238000009877 rendering Methods 0.000 claims abstract description 46
- 238000010606 normalization Methods 0.000 claims description 13
- 230000035807 sensation Effects 0.000 claims description 6
- 238000000926 separation method Methods 0.000 claims description 6
- 239000013598 vector Substances 0.000 description 6
- 238000004364 calculation method Methods 0.000 description 5
- 238000012986 modification Methods 0.000 description 3
- 230000004048 modification Effects 0.000 description 3
- 241001422033 Thestylus Species 0.000 description 2
- 238000010586 diagram Methods 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 230000006870 function Effects 0.000 description 2
- 230000008569 process Effects 0.000 description 2
- 230000014509 gene expression Effects 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000002085 persistent effect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 230000001052 transient effect Effects 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input 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/01—Input arrangements or combined input and output arrangements for interaction between user and computer
- G06F3/048—Interaction techniques based on graphical user interfaces [GUI]
- G06F3/0487—Interaction techniques based on graphical user interfaces [GUI] using specific features provided by the input device, e.g. functions controlled by the rotation of a mouse with dual sensing arrangements, or of the nature of the input device, e.g. tap gestures based on pressure sensed by a digitiser
- G06F3/0488—Interaction techniques based on graphical user interfaces [GUI] using specific features provided by the input device, e.g. functions controlled by the rotation of a mouse with dual sensing arrangements, or of the nature of the input device, e.g. tap gestures based on pressure sensed by a digitiser using a touch-screen or digitiser, e.g. input of commands through traced gestures
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input 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/01—Input arrangements or combined input and output arrangements for interaction between user and computer
- G06F3/03—Arrangements for converting the position or the displacement of a member into a coded form
- G06F3/041—Digitisers, e.g. for touch screens or touch pads, characterised by the transducing means
- G06F3/0414—Digitisers, e.g. for touch screens or touch pads, characterised by the transducing means using force sensing means to determine a position
Landscapes
- Engineering & Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Human Computer Interaction (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- User Interface Of Digital Computer (AREA)
Abstract
The invention discloses a method, a device and a storage medium for separating hand strokes and pen strokes in H5 webpage handwriting application, wherein the method comprises the following steps: receiving touch operation of a user in an H5 webpage application; acquiring a normalized pressure-sensitive value in the touch operation event; judging whether the touch identification position in the pressure value is a hand touch identification position or a pen touch identification position; if the touch identification position in the pressure value is a hand touch identification position, rendering the touch operation; and if the touch control identification position in the pressure sensing value is a pen touch control identification position, rendering the touch control operation according to the pressure sensing value. By the implementation of the method, the pen-touch operation and the hand-touch operation in the H5 webpage handwriting application can be rapidly identified, the pen-touch operation is rendered to generate handwriting, and the hand-touch operation is not rendered to generate the handwriting. Therefore, when the pen is used for writing in H5 webpage handwriting application, the hand and the pen are in contact with the screen at the same time, redundant hand touch events cannot interfere with handwriting events, and redundant handwriting is avoided.
Description
Technical Field
The invention relates to the field of intelligent terminals, in particular to a method and a device for separating hand, stylus and touch in H5 webpage handwriting application and a storage medium.
Background
Tablet computers with a stylus function, such as Android tablet computers or ipads, generally have multiple touch input sources, such as a stylus and a finger, so as to generate corresponding input modes: pen touches and hand touches. The Native application developed by using the Native technology can interact with an operating system through a diversified system API (application programming interface), obtain more touch event parameters, such as getToolType disclosed in MotionEvent in an Android system, and immediately judge whether the current event is a pen touch, a hand touch or an eraser. If the current touch source is a hand touch or a pen touch, redundant events generated by a certain touch source can be specifically shielded when multiple touch sources take effect at the same time, for example, the hand touch events are shielded when the pen touch takes effect, so that the mutual interference of the events of the multiple touch sources is avoided, and better handwriting experience of a handwriting pen is provided for a user.
However, the web application of HTML5 (hereinafter referred to as H5) that realizes the handwriting function does not experience as well as native applications, because the H5 web application is a standard event PointerEvents (including a pen, a hand touch, and a mouse, and W3C specifies that key values of the hand touch, the pen touch, and a left mouse key are all 1, and therefore cannot be distinguished according to the key values) that is based on a browser or WebView and conforms to the W3C web specification, the event has certain limitations. Under the scene that a mobile intelligent terminal (Android or IOS) supports multiple touch sources such as hand touch and pen touch at the same time, the pen touch or the hand touch cannot be correctly distinguished. Thus, when the user writes on the screen by holding the pen, the touching of the palm or finger part can be regarded as a writing event by the webpage, and a redundant invalid input event, namely a visual redundant stroke, is generated.
Disclosure of Invention
The invention aims to provide a method and a device for separating hand strokes from hand strokes in H5 webpage handwriting application and a storage medium. The problem that when a pen is used for writing in H5 webpage handwriting application, a hand and the pen are in contact with a screen at the same time, redundant hand touch events can interfere with handwriting events, and redundant handwriting is generated can be solved.
In view of this, the first aspect of the present invention provides a method for separating a stylus stroke in an H5 web page handwriting application, where the method includes:
receiving touch operation of a user in an H5 webpage application;
acquiring a normalized pressure-sensitive value in the touch operation event;
judging whether the touch identification position in the pressure value is a hand touch identification position or a pen touch identification position;
if the touch identification position in the pressure value is a hand touch identification position, rendering the touch operation;
and if the touch control identification position in the pressure sensing value is a pen touch control identification position, rendering the touch control operation according to the pressure sensing value.
Optionally, with reference to the first aspect, in a possible implementation manner, the step of obtaining a normalized pressure-sensitive value in the touch operation event specifically includes:
acquiring the touch type and the original pressure data of the touch operation;
and calculating a pressure sensing value according to the original pressure sensing data and a normalization algorithm, and adding the touch identification bit corresponding to the touch type into the pressure sensing value.
Optionally, with reference to the first aspect, in a possible implementation manner, the calculation formula for calculating the pressure sensing value according to the normalization algorithm is:
pr_after=(pr*10^(BitsCnt-1)+isPen)/10^(BitsCnt)
wherein pr _ after is a pressure value; pr is an original pressure value in the original pressure sensation data; bitscnt is the precision digit in the original pressure-sensitive data; isPen is a touch identification bit, and the value is 0 or 1.
Optionally, with reference to the first aspect, in a possible implementation manner, the step of rendering the touch operation according to the pressure value specifically includes:
acquiring handwriting coordinate information of the touch operation;
and calculating and rendering the handwriting in the touch operation event according to the handwriting coordinate information, the pressure value and the preset handwriting width.
Optionally, with reference to the first aspect, in a possible implementation manner, the specific manner of calculating and rendering the handwriting in the touch operation event includes:
two control points of a second-order Bessel starting point are calculated:
pc1=(pstart.x-sin(atan2(pstart,pend))*pr_after*W,pstart.y+cos(atan2(pstart,pend))*pr*W);
pc2=(pstart.x+sin(atan2(pstart,pend))*pr_after*W,pstart.y-cos(atan2(pstart,pend))*pr*W);
two control points of a second-order Bessel termination point are calculated:
pc1=(pend.x-sin(atan2(pstart,pend))*pr_after*W,pend.y+cos(atan2(pstart,pend))*pr*W);
pc2=(pend.x+sin(atan2(pstart,pend))*pr_after*W,pend.y-cos(atan2(pstart,pend))*pr*W);
wherein the pstart.x is a starting point X coordinate, the (pstart, pend) is a starting point coordinate and a termination point coordinate, the pstart.y is a starting point Y coordinate, the pend.x is a termination point X coordinate, the pend.y is a termination point Y coordinate, the pr _ after is a pressure value, and the W is a preset handwriting width;
and performing handwriting rendering according to the two calculated control points of the second-order Bezier starting point, the two calculated control points of the second-order Bezier ending point and the handwriting coordinate information.
The second aspect of the present invention provides a hand-touch and pen-touch separating device for H5 webpage handwriting application, comprising:
the touch control receiving module is used for receiving touch control operation of a user in an H5 webpage application;
the pressure-sensitive data processing module is used for acquiring a normalized pressure-sensitive value in the touch operation event;
the judging module is used for judging that the touch identification position in the pressure value is a hand touch identification position or a pen touch identification position;
the handwriting rendering module is used for not rendering the touch operation when the touch identification position in the pressure value is a hand touch identification position; and when the touch control identification position in the pressure sensing value is a pen touch identification position, rendering the touch control operation according to the pressure sensing value.
Optionally, with reference to the second aspect, in a possible implementation manner, the pressure-sensitive data processing module specifically includes:
the data acquisition unit is used for acquiring the touch type and the original pressure-sensitive data of the touch operation;
and the data processing unit is used for calculating a pressure sensing value according to the original pressure sensing data and a normalization algorithm and adding the touch identification bit corresponding to the touch type into the pressure sensing value.
Optionally, with reference to the second aspect, in a possible implementation manner, the data processing unit calculates the pressure-sensitive value according to a normalization algorithm by using a calculation formula that:
pr_after=(pr*10^(BitsCnt-1)+isPen)/10^(BitsCnt)
wherein pr _ after is a pressure value; pr is an original pressure value in the original pressure sensation data; bitscnt is the precision digit in the original pressure-sensitive data; isPen is a touch identification bit, and the value is 0 or 1.
Optionally, with reference to the second aspect, in a possible implementation manner, the handwriting rendering module specifically includes:
the handwriting acquisition unit is used for acquiring handwriting coordinate information of the touch operation;
and the handwriting processing unit is used for calculating and rendering the handwriting in the touch operation event according to the handwriting coordinate information, the pressure sensing value and the preset handwriting width.
A third aspect of the present application provides a non-transitory computer-readable storage medium having stored thereon computer-executable instructions that, when executed by one or more processors, may cause the one or more processors to perform the method as set forth in any one of the possible implementations of the first aspect of the present application to the first aspect.
The invention discloses a method, a device and a storage medium for separating a hand touch and a pen touch in H5 webpage handwriting application, which are used for receiving touch operation of a user in the H5 webpage application when the method for separating the hand touch and the pen touch in the H5 webpage handwriting application is implemented, acquiring a normalized pressure value in a touch operation event, and judging that a touch identification position in the pressure value is a hand touch identification position or a pen touch identification position. If the touch identification position in the pressure value is a hand touch identification position, rendering the touch operation; and if the touch control identification position in the pressure sensing value is a pen touch control identification position, rendering the touch control operation according to the pressure sensing value. By the implementation of the method, the pen-touch operation and the hand-touch operation in the H5 webpage handwriting application can be rapidly identified, the pen-touch operation is rendered to generate handwriting, and the hand-touch operation is not rendered to generate the handwriting. Therefore, when the pen is used for writing in H5 webpage handwriting application, the hand and the pen are in contact with the screen at the same time, redundant hand touch events cannot interfere with handwriting events, and redundant handwriting is avoided.
Drawings
The invention will be further described with reference to the accompanying drawings and examples, in which:
FIG. 1 is a flowchart of a method for separating a stylus stroke in an H5 webpage handwriting application according to the present invention;
FIG. 2 is a sub-flowchart of step S102 in the method for separating the handwriting strokes in the H5 webpage handwriting application according to the present invention;
FIG. 3 is a sub-flowchart of step S105 of the method for separating the handwriting strokes in the H5 webpage handwriting application according to the present invention;
fig. 4 is a schematic structural diagram of a stylus-touch separating device in an H5 web page handwriting application provided by the present invention.
Detailed Description
The embodiment of the application provides a method for separating hand touch and pen touch in H5 webpage handwriting application and a related device, and aims to solve the problem that when a pen is used for writing in H5 webpage handwriting application, the pen and the hand touch simultaneously contact a screen, redundant hand touch events can interfere with the handwriting events, and redundant handwriting is generated.
The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application. In the present application, "at least one" means one or more, "a plurality" means two or more. "and/or" describes the association relationship of the associated objects, meaning that there may be three relationships, e.g., a and/or B, which may mean: a exists alone, A and B exist simultaneously, and B exists alone, wherein A and B can be singular or plural. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship. "at least one of the following" or similar expressions refer to any combination of these items, including any combination of the singular or plural items. For example, at least one (one) of a, b, or c, may represent: a, b, c, a and b, a and c, b and c or a and b and c, wherein a, b and c can be single or multiple. It is to be noted that "at least one item" may also be interpreted as "one or more item(s)".
It is noted that, in the present application, words such as "exemplary" or "for example" are used to mean exemplary, illustrative, or descriptive. Any embodiment or design described herein as "exemplary" or "e.g.," is not necessarily to be construed as preferred or advantageous over other embodiments or designs. Rather, use of the word "exemplary" or "such as" is intended to present concepts related in a concrete fashion.
The descriptions of the first, second, etc. appearing in the embodiments of the present application are only for illustrating and differentiating the objects, and do not represent the order or the particular limitation of the number of the devices in the embodiments of the present application, and do not constitute any limitation to the embodiments of the present application.
The application provides a method for separating a hand touch and a pen touch in H5 webpage handwriting application, please refer to FIG. 1, and the method comprises the following steps:
step S101, receiving a touch operation of a user in the H5 web application.
Specifically, when a user browses an H5 webpage application by using a tablet computer, touch operation can be performed on the H5 webpage application, where the touch operation may include a pen touch and a hand touch, the pen touch is mainly used for annotating and marking webpage content, and the hand touch is mainly used for browsing and switching the webpage content.
Step S102, obtaining a normalized pressure-sensitive value in the touch operation event.
After receiving the touch operation input by the user, acquiring a normalized pressure-sensitive value in the current touch operation event, wherein the pressure-sensitive value is obtained by calculating according to a normalization algorithm according to original pressure-sensitive data of the current touch operation event, which is described in detail later.
Step S103, determining the touch identification position in the pressure value as a hand touch identification position or a pen touch identification position.
And reading the touch identification position in the pressure value, and judging the touch identification position to be a hand touch identification position or a pen touch identification position, thereby realizing the judgment of whether the touch operation is the hand touch operation or the pen touch operation according to the pressure value.
If the touch identification position in the pressure value is a hand touch identification position, executing step S104; if the touch identification position in the pressure value is a pen touch identification position, executing step S105;
in step S104, the touch operation is not rendered.
When the current touch operation is judged to be the hand touch operation, the rendering processing is not carried out on the current hand touch operation, namely, the handwriting of the current touch operation is not displayed.
In step S105, rendering is performed on the touch operation according to the pressure value.
And when the current touch operation is judged to be the pen touch operation, rendering the current pen touch operation, namely displaying the corresponding handwriting on the tablet computer according to the current touch operation.
When the method for separating the hand touch from the pen touch in the H5 webpage handwriting application is implemented, the touch operation of a user is received in the H5 webpage application, the normalized pressure value in the touch operation event is obtained, and the touch identification position in the pressure value is judged to be the hand touch identification position or the pen touch identification position. If the touch identification position in the pressure value is a hand touch identification position, rendering the touch operation; and if the touch control identification position in the pressure sensing value is a pen touch control identification position, rendering the touch control operation according to the pressure sensing value. By the implementation of the method, the pen-touch operation and the hand-touch operation in the H5 webpage handwriting application can be rapidly identified, the pen-touch operation is rendered to generate handwriting, and the hand-touch operation is not rendered to generate the handwriting. Therefore, when the pen is used for writing in H5 webpage handwriting application, the hand and the pen are in contact with the screen at the same time, redundant hand touch events cannot interfere with handwriting events, and redundant handwriting is avoided.
Referring to fig. 2, in an embodiment of the present invention, the step S102 of obtaining the normalized pressure-sensitive value in the touch operation event specifically includes:
step S1021, acquiring the touch type and the original pressure data of the touch operation;
step S1022, calculate a pressure-sensitive value according to the raw pressure-sensitive data and a normalization algorithm, and add the touch identification bit corresponding to the touch type to the pressure-sensitive value.
Further, the calculation formula for calculating the pressure sensing value according to the normalization algorithm is as follows:
pr_after=(pr*10^(BitsCnt-1)+isPen)/10^(BitsCnt)
wherein pr _ after is a pressure value; pr is an original pressure value in the original pressure sensation data; bitscnt is the precision digit in the original pressure-sensitive data; isPen is a touch identification bit, and the value is 0 or 1.
Preferably, the value of the pen touch identification bit is 0, and the value of the hand touch identification bit is 1.
Referring to fig. 3, in another embodiment of the present invention, the step S105 of rendering the touch operation according to the pressure value specifically includes:
step S1051, acquiring handwriting coordinate information of the touch operation;
and step 1052, calculating and rendering the handwriting in the touch operation event according to the handwriting coordinate information, the pressure value and the preset handwriting width.
Specifically, the specific way of calculating and rendering the handwriting in the touch operation event includes:
two control points of a second-order Bessel starting point are calculated:
pc1=(pstart.x-sin(atan2(pstart,pend))*pr_after*W,pstart.y+cos(atan2(pstart,pend))*pr*W);
pc2=(pstart.x+sin(atan2(pstart,pend))*pr_after*W,pstart.y-cos(atan2(pstart,pend))*pr*W);
two control points of a second-order Bessel termination point are calculated:
pc1=(pend.x-sin(atan2(pstart,pend))*pr_after*W,pend.y+cos(atan2(pstart,pend))*pr*W);
pc2=(pend.x+sin(atan2(pstart,pend))*pr_after*W,pend.y-cos(atan2(pstart,pend))*pr*W);
wherein the pstart.x is a starting point X coordinate, the (pstart, pend) is a starting point coordinate and a termination point coordinate, the pstart.y is a starting point Y coordinate, the pend.x is a termination point X coordinate, the pend.y is a termination point Y coordinate, the pr _ after is a pressure value, and the W is a preset handwriting width;
and performing handwriting rendering according to the two calculated control points of the second-order Bezier starting point, the two calculated control points of the second-order Bezier ending point and the handwriting coordinate information.
Wherein, the formula for calculating the starting point is as follows: the origin is a circle, the center of which is cartesian coordinates (x0, y0) of a vector of the origin p0, and the radius W is f (pr, finger).
Formula when calculating line segment: the starting point is the vector of the original point p1, i.e. cartesian coordinates (x1, y1), and the ending point is the median of the vectors of p1 and p2, i.e. pe ═ f (p1, p2, pr, finger).
The processing pressure value formula is as follows: f (p, finger) ═ p finger; finger takes the value {0,1 }.
The present application further provides a schematic structural diagram of a device for separating a stylus from a stylus in H5 web handwriting application, please refer to fig. 4, where the device includes:
the touch control receiving module is used for receiving touch control operation of a user in an H5 webpage application;
the pressure-sensitive data processing module is used for acquiring a normalized pressure-sensitive value in the touch operation event;
the judging module is used for judging that the touch identification position in the pressure value is a hand touch identification position or a pen touch identification position;
the handwriting rendering module is used for not rendering the touch operation when the touch identification position in the pressure value is a hand touch identification position; and when the touch control identification position in the pressure sensing value is a pen touch identification position, rendering the touch control operation according to the pressure sensing value.
Specifically, when a user browses an H5 webpage application by using a tablet computer, touch operation can be performed on the H5 webpage application, where the touch operation may include a pen touch and a hand touch, the pen touch is mainly used for annotating and marking webpage content, and the hand touch is mainly used for browsing and switching the webpage content. After receiving touch operation input by a user, acquiring a normalized pressure-sensitive value in the current touch operation event, wherein the pressure-sensitive value is obtained by calculation according to a normalization algorithm according to original pressure-sensitive data of the current touch operation event. And reading the touch identification position in the pressure value, and judging the touch identification position to be a hand touch identification position or a pen touch identification position, thereby realizing the judgment of whether the touch operation is the hand touch operation or the pen touch operation according to the pressure value. When the current touch operation is judged to be the hand touch operation, the rendering processing is not carried out on the current hand touch operation, namely, the handwriting of the current touch operation is not displayed. And when the current touch operation is judged to be the pen touch operation, rendering the current pen touch operation, namely displaying the corresponding handwriting on the tablet computer according to the current touch operation.
When the hand-touch and pen-touch separation device in the H5 webpage handwriting application is used, the touch operation of a user is received in the H5 webpage application, the normalized pressure value in the touch operation event is obtained, and the touch identification position in the pressure value is judged to be the hand-touch identification position or the pen-touch identification position. If the touch identification position in the pressure value is a hand touch identification position, rendering the touch operation; and if the touch control identification position in the pressure sensing value is a pen touch control identification position, rendering the touch control operation according to the pressure sensing value. By the implementation of the method, the pen-touch operation and the hand-touch operation in the H5 webpage handwriting application can be rapidly identified, the pen-touch operation is rendered to generate handwriting, and the hand-touch operation is not rendered to generate the handwriting. Therefore, when the pen is used for writing in H5 webpage handwriting application, the hand and the pen are in contact with the screen at the same time, redundant hand touch events cannot interfere with handwriting events, and redundant handwriting is avoided.
Specifically, the pressure-sensitive data processing module specifically includes:
the data acquisition unit is used for acquiring the touch type and the original pressure-sensitive data of the touch operation;
and the data processing unit is used for calculating a pressure sensing value according to the original pressure sensing data and a normalization algorithm and adding the touch identification bit corresponding to the touch type into the pressure sensing value.
Specifically, the calculation formula of the data processing unit for calculating the pressure sensing value according to the normalization algorithm is as follows:
pr_after=(pr*10^(BitsCnt-1)+isPen)/10^(BitsCnt)
wherein pr _ after is a pressure value; pr is an original pressure value in the original pressure sensation data; bitscnt is the precision digit in the original pressure-sensitive data; isPen is a touch identification bit, and the value is 0 or 1.
Preferably, the value of the pen touch identification bit is 0, and the value of the hand touch identification bit is 1.
The handwriting rendering module specifically comprises:
the handwriting acquisition unit is used for acquiring handwriting coordinate information of the touch operation;
and the handwriting processing unit is used for calculating and rendering the handwriting in the touch operation event according to the handwriting coordinate information, the pressure sensing value and the preset handwriting width.
Specifically, the specific way of calculating and rendering the handwriting in the touch operation event includes:
two control points of a second-order Bessel starting point are calculated:
pc1=(pstart.x-sin(atan2(pstart,pend))*pr_after*W,pstart.y+cos(atan2(pstart,pend))*pr*W);
pc2=(pstart.x+sin(atan2(pstart,pend))*pr_after*W,pstart.y-cos(atan2(pstart,pend))*pr*W);
two control points of a second-order Bessel termination point are calculated:
pc1=(pend.x-sin(atan2(pstart,pend))*pr_after*W,pend.y+cos(atan2(pstart,pend))*pr*W);
pc2=(pend.x+sin(atan2(pstart,pend))*pr_after*W,pend.y-cos(atan2(pstart,pend))*pr*W);
wherein the pstart.x is a starting point X coordinate, the (pstart, pend) is a starting point coordinate and a termination point coordinate, the pstart.y is a starting point Y coordinate, the pend.x is a termination point X coordinate, the pend.y is a termination point Y coordinate, the pr _ after is a pressure value, and the W is a preset handwriting width;
and performing handwriting rendering according to the two calculated control points of the second-order Bezier starting point, the two calculated control points of the second-order Bezier ending point and the handwriting coordinate information.
Wherein, the formula for calculating the starting point is as follows: the origin is a circle, the center of which is cartesian coordinates (x0, y0) of a vector of the origin p0, and the radius W is f (pr, finger).
Formula when calculating line segment: the starting point is the vector of the original point p1, i.e. cartesian coordinates (x1, y1), and the ending point is the median of the vectors of p1 and p2, i.e. pe ═ f (p1, p2, pr, finger).
The processing pressure value formula is as follows: f (p, finger) ═ p finger; finger takes the value {0,1 }.
In another embodiment of the apparatus for separating the handwriting of H5 web page provided by the embodiment of the present application, the apparatus for separating the handwriting of H5 web page can generate relatively large differences due to different configurations or performances, and may include one or more processors (CPUs) (e.g., one or more processors) and a memory, and one or more storage media (e.g., one or more mass storage devices) for storing applications or data. The memory and storage medium may be, among other things, transient or persistent storage. The program stored on the storage medium may include one or more modules, each of which may include a sequence of instruction operations for a stylus-touch separation mechanism in an H5 web-page handwriting application. Further, the processor may be configured to communicate with a storage medium to execute a sequence of instruction operations in the storage medium on a stylus-touch separation device in an H5 web handwriting application.
The stylus-touch separation device in the H5 web page handwriting application may further include one or more power supplies, one or more wired or wireless network interfaces, one or more input/output interfaces, and/or one or more operating systems, such as Android, Windows service, Mac OS X, Unix, Linux, FreeBSD, and the like. Those skilled in the art will appreciate that the structure of the stylus pen-touch separation device in the H5 web handwriting application does not constitute a limitation of the data processing apparatus, and may include more or fewer components, or some components in combination, or a different arrangement of components.
The present application also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium, and may also be a volatile computer-readable storage medium, having stored therein instructions, which, when executed on a computer, cause the computer to perform the steps of the method for separating the hand-touch strokes in the H5 webpage handwriting application.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or contributed to by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a read-only memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
In the examples provided herein, it is to be understood that the disclosed methods may be practiced otherwise than as specifically described without departing from the spirit and scope of the present application. The present embodiment is an exemplary example only, and should not be taken as limiting, and the specific disclosure should not be taken as limiting the purpose of the application. For example, some features may be omitted, or not performed.
The technical means disclosed in the present application is not limited to the technical means disclosed in the above embodiments, and includes technical means formed by any combination of the above technical features. It should be noted that, for those skilled in the art, without departing from the principle of the present application, several improvements and modifications can be made, and these improvements and modifications are also considered to be within the scope of the present application.
The method, the device and the storage medium for separating the handwriting from the stylus strokes in the H5 web handwriting application provided by the embodiment of the present application are described in detail above, a specific example is applied in the present application to explain the principle and the implementation of the present application, and the description of the above embodiment is only used to help understanding the method and the core idea of the present application; meanwhile, for a person skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application. Although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions in the embodiments of the present application.
Claims (10)
1. A method for separating a hand touch and a pen touch in H5 webpage handwriting application is characterized by comprising the following steps:
receiving touch operation of a user in an H5 webpage application;
acquiring a normalized pressure-sensitive value in the touch operation event;
judging whether the touch identification position in the pressure sensing value is a hand touch identification position or a pen touch identification position;
if the touch identification position in the pressure value is a hand touch identification position, rendering the touch operation;
and if the touch control identification position in the pressure sensing value is a pen touch identification position, rendering the touch control operation according to the pressure sensing value.
2. The method for separating the handwriting from the H5 webpage in the handwriting application according to claim 1, wherein the step of obtaining the normalized pressure-sensitive value in the touch operation event specifically comprises:
acquiring the touch type and the original pressure-sensitive data of the touch operation;
and calculating a pressure sensing value according to the original pressure sensing data and a normalization algorithm, and adding a touch identification bit corresponding to the touch type into the pressure sensing value.
3. The method for separating the handwriting stroke from the H5 webpage in the handwriting application of the claim 2, wherein the formula for calculating the pressure value according to the normalization algorithm is as follows:
pr_after=(pr*10^(BitsCnt-1)+isPen)/10^(BitsCnt)
wherein pr _ after is a pressure value; pr is an original pressure value in the original pressure sensation data; bitscnt is the precision digit in the original pressure-sensitive data; isPen is a touch identification bit, and the value is 0 or 1.
4. The method for separating the handwriting from the H5 webpage in the handwriting application according to claim 3, wherein the step of rendering the touch operation according to the pressure value comprises:
acquiring handwriting coordinate information of the touch operation;
and calculating and rendering the handwriting in the touch operation event according to the handwriting coordinate information, the pressure value and the preset handwriting width.
5. The H5 webpage handwriting application hand-touch-pen-touch separation method according to claim 4, wherein the specific way of calculating and rendering the handwriting in the touch operation event includes:
two control points of a second-order Bessel starting point are calculated:
pc1=(pstart.x-sin(atan2(pstart,pend))*pr_after*W,pstart.y+cos(atan2(pstart,pend))*pr*W);
pc2=(pstart.x+sin(atan2(pstart,pend))*pr_after*W,pstart.y-cos(atan2(pstart,pend))*pr*W);
two control points of a second-order Bessel termination point are calculated:
pc1=(pend.x-sin(atan2(pstart,pend))*pr_after*W,pend.y+cos(atan2(pstart,pe nd))*pr*W);
pc2=(pend.x+sin(atan2(pstart,pend))*pr_after*W,pend.y-cos(atan2(pstart,pe nd))*pr*W);
wherein pstart.x is a starting point X coordinate, pstart, pend are a starting point coordinate and a termination point coordinate, pstart.y is a starting point Y coordinate, pend.x is a termination point X coordinate, pend.y is a termination point Y coordinate, pr _ after is a pressure value, and W is a preset handwriting width;
and performing handwriting rendering according to the two calculated control points of the second-order Bezier starting point, the two calculated control points of the second-order Bezier ending point and the handwriting coordinate information.
6. A device for separating the strokes of a hand stylus in H5 webpage handwriting application, the device comprising:
the touch control receiving module is used for receiving touch control operation of a user in an H5 webpage application;
the pressure-sensitive data processing module is used for acquiring a normalized pressure-sensitive value in the touch operation event;
the judging module is used for judging that the touch identification position in the pressure sensing value is a hand touch identification position or a pen touch identification position;
the handwriting rendering module is used for not rendering the touch operation when the touch identification position in the pressure value is a hand touch identification position; and when the touch control identification position in the pressure sensing value is a pen touch identification position, rendering the touch control operation according to the pressure sensing value.
7. The H5 handwriting application of webpage with stylus touch separating device of claim 6, wherein the pressure data processing module comprises:
the data acquisition unit is used for acquiring the touch type and the original pressure-sensitive data of the touch operation;
and the data processing unit is used for calculating a pressure sensing value according to the original pressure sensing data and a normalization algorithm and adding the touch identification bit corresponding to the touch type into the pressure sensing value.
8. The apparatus for separating the handwriting stroke from the H5 webpage in handwriting application according to claim 7, wherein the data processing unit calculates the pressure value according to the normalized algorithm by the following formula:
pr_after=(pr*10^(BitsCnt-1)+isPen)/10^(BitsCnt)
wherein pr _ after is a pressure value; pr is an original pressure value in the original pressure sensation data; bitscnt is the precision digit in the original pressure-sensitive data; isPen is a touch identification bit, and the value is 0 or 1.
9. The apparatus for separating the handwriting stroke of H5 in the webpage handwriting application according to claim 8, wherein the handwriting rendering module specifically comprises:
the handwriting acquisition unit is used for acquiring handwriting coordinate information of the touch operation;
and the handwriting processing unit is used for calculating and rendering the handwriting in the touch operation event according to the handwriting coordinate information, the pressure sensing value and the preset handwriting width.
10. A non-transitory computer-readable storage medium storing computer-executable instructions that, when executed by one or more processors, cause the one or more processors to perform the method of any one of claims 1-5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111230720.3A CN114115686B (en) | 2021-10-22 | 2021-10-22 | Method, device and storage medium for separating hand touch pen and touch in H5 webpage handwriting application |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111230720.3A CN114115686B (en) | 2021-10-22 | 2021-10-22 | Method, device and storage medium for separating hand touch pen and touch in H5 webpage handwriting application |
Publications (2)
Publication Number | Publication Date |
---|---|
CN114115686A true CN114115686A (en) | 2022-03-01 |
CN114115686B CN114115686B (en) | 2024-04-30 |
Family
ID=80376600
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111230720.3A Active CN114115686B (en) | 2021-10-22 | 2021-10-22 | Method, device and storage medium for separating hand touch pen and touch in H5 webpage handwriting application |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114115686B (en) |
Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102063236A (en) * | 2010-12-29 | 2011-05-18 | 福州锐达数码科技有限公司 | Method for identifying pressure sensitive electronic whiteboard by touch |
US20120306927A1 (en) * | 2011-05-30 | 2012-12-06 | Lg Electronics Inc. | Mobile terminal and display controlling method thereof |
WO2014089518A1 (en) * | 2012-12-06 | 2014-06-12 | Communication Intelligence Corp. | System and method for signing electronic documents |
CN105229590A (en) * | 2013-04-26 | 2016-01-06 | 三星电子株式会社 | There is the user terminal apparatus of pen and the control method of user terminal apparatus |
CN106155608A (en) * | 2015-04-08 | 2016-11-23 | 北京壹人壹本信息科技有限公司 | A kind of former person's handwriting storage and display packing, system and equipment |
US20170052696A1 (en) * | 2015-08-19 | 2017-02-23 | Sharon L. Oviatt | Adapting computer functionality based on handwriting energy expenditure |
US20170060821A1 (en) * | 2015-08-25 | 2017-03-02 | Myscript | System and method of digital note taking |
CN108228069A (en) * | 2017-12-21 | 2018-06-29 | 北京壹人壹本信息科技有限公司 | Hand-written script input method, mobile terminal and device |
US10043056B1 (en) * | 2017-03-31 | 2018-08-07 | International Business Machines Corporation | Analyzing writing using pressure sensing touchscreens |
CN110058763A (en) * | 2019-03-19 | 2019-07-26 | 广州视源电子科技股份有限公司 | Mutual information processing method, system, device, storage medium and notebook |
-
2021
- 2021-10-22 CN CN202111230720.3A patent/CN114115686B/en active Active
Patent Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102063236A (en) * | 2010-12-29 | 2011-05-18 | 福州锐达数码科技有限公司 | Method for identifying pressure sensitive electronic whiteboard by touch |
US20120306927A1 (en) * | 2011-05-30 | 2012-12-06 | Lg Electronics Inc. | Mobile terminal and display controlling method thereof |
WO2014089518A1 (en) * | 2012-12-06 | 2014-06-12 | Communication Intelligence Corp. | System and method for signing electronic documents |
CN105229590A (en) * | 2013-04-26 | 2016-01-06 | 三星电子株式会社 | There is the user terminal apparatus of pen and the control method of user terminal apparatus |
CN106155608A (en) * | 2015-04-08 | 2016-11-23 | 北京壹人壹本信息科技有限公司 | A kind of former person's handwriting storage and display packing, system and equipment |
US20170052696A1 (en) * | 2015-08-19 | 2017-02-23 | Sharon L. Oviatt | Adapting computer functionality based on handwriting energy expenditure |
US20170060821A1 (en) * | 2015-08-25 | 2017-03-02 | Myscript | System and method of digital note taking |
US10043056B1 (en) * | 2017-03-31 | 2018-08-07 | International Business Machines Corporation | Analyzing writing using pressure sensing touchscreens |
CN108228069A (en) * | 2017-12-21 | 2018-06-29 | 北京壹人壹本信息科技有限公司 | Hand-written script input method, mobile terminal and device |
CN110058763A (en) * | 2019-03-19 | 2019-07-26 | 广州视源电子科技股份有限公司 | Mutual information processing method, system, device, storage medium and notebook |
Also Published As
Publication number | Publication date |
---|---|
CN114115686B (en) | 2024-04-30 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11580761B2 (en) | Ink file searching method, apparatus, and program | |
CN1758205B (en) | Flick gesture | |
US20130083074A1 (en) | Methods, apparatuses and computer program products utilizing hovering, in part, to determine user interface orientation | |
US20160291763A1 (en) | Emulating pressure sensitivity on multi-touch devices | |
CN105814531A (en) | User interface adaptation from an input source identifier change | |
KR102257172B1 (en) | System and method for recognizing geometric shapes | |
US10521105B2 (en) | Detecting primary hover point for multi-hover point device | |
CN109144370B (en) | Screen capturing method, device, terminal and computer readable medium | |
EP4060465A2 (en) | Method and apparatus for controlling terminal, device and storage medium | |
CN112965645B (en) | Page dragging method and device, computer equipment and storage medium | |
WO2012158895A2 (en) | Disambiguating intentional and incidental contact and motion in multi-touch pointing devices | |
KR102052639B1 (en) | Method for identifying object and an electronic device thereof | |
US9927971B2 (en) | Electronic apparatus, method and storage medium for generating chart object | |
CN109298809A (en) | A kind of touch action recognition methods, device and terminal device | |
CN110658976A (en) | Touch track display method and electronic equipment | |
CN106020712B (en) | Touch gesture recognition method and device | |
CN114115686A (en) | Method and device for separating hand, stylus and touch in H5 webpage handwriting application and storage medium | |
CN107679219B (en) | Matching method and device, interactive intelligent panel and storage medium | |
CN107728826B (en) | Object filter | |
US20140300563A1 (en) | Control device and control method | |
JP2014175012A (en) | Mouse pointer control method | |
US9459790B2 (en) | Method and apparatus for controlling dot rendering on a touch screen | |
CN112751799A (en) | Verification method and device based on picture verification code | |
US10691207B2 (en) | Display devices with virtual reprsentations of electronic devices | |
CN115035261B (en) | Method, device, equipment and medium for generating collision device |
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 |