Electromagnetic pen pointer event processing method suitable for electronic ink screen equipment
By implementing fault-tolerant judgment of electromagnetic pen pointer events at the front-end application level, the slight displacement problem of click operations on e-ink screen devices is solved, achieving a more natural and sensitive click experience, applicable to both electromagnetic pens and e-ink screen devices.
Patent Information
- Application Number
- CN202510860337.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-25
- Publication Date
- 2025-10-31
AI Technical Summary
When using an electromagnetic pen to click on an e-ink screen device, due to device refresh delay and input coordinate jitter, the strict native click judgment logic of existing browsers causes slight displacement to cause click events to frequently fail, reducing the sensitivity and accuracy of user interaction.
A fault-tolerant click event triggering mechanism is established at the front-end application level. By listening to pointer press and move events, calculating the movement distance and setting a threshold, electromagnetic pen operations with slight displacement are judged as valid clicks, and simulated click events are resent.
It improves the sensitivity of click event triggering and user experience, adapts to special hardware environments such as e-ink screens, and avoids the complexity of hardware or browser kernel modifications.
Smart Images

Figure CN120872167A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of human-computer interaction technology, specifically providing a method for processing electromagnetic pen pointer events applicable to electronic ink screen devices. Background Technology
[0002] With the development of mobile internet and smart terminals, more and more users are browsing the web and interacting with other devices via browsers. Compared to traditional mouse operation, pointer input methods such as styluses (e.g., electromagnetic pens) and fingers are becoming increasingly common on mobile terminals (especially Android tablets and e-readers), providing users with more diverse interaction methods. However, in specific hardware environments, such as e-ink devices, the user experience differs significantly from that of traditional LCD screens. E-ink screens offer advantages such as low power consumption and paper-like display effects, but they also suffer from a relatively long refresh rate. Due to refresh rate delays and other hardware characteristics, electromagnetic pens often encounter the following problems when interacting with e-ink screens:
[0003] 1. Minor displacements caused by the precision of electromagnetic pen input and refresh latency. Traditional browsers' native click event detection logic is usually based on the user's rapid pressing and releasing actions on an element. If the user makes a significant pointer movement during the pressing and releasing (such as movement outside the element area), the browser will consider the user to be dragging or swiping rather than clicking, and therefore will not trigger a click event.
[0004] causation:
[0005] • Cause: The e-ink screen has a refresh delay, and the pointer input of the electromagnetic pen is not stable enough within a small range, which causes the pointer coordinates to jitter or slightly shift between the pointer down event when the pointer is pressed on the screen and the pointer up event when the pointer is released from the screen.
[0006] ·Result: The browser cannot determine whether this slight offset is a movement operation that the user actually intends to make, and therefore treats it as a non-click action, thus not activating the native click event.
[0007] 2. Current common solutions rely directly on the browser's native event logic, which is sufficiently sensitive and reasonable for mouse or capacitive touchscreen scenarios. However, in the unique environment of combining an electromagnetic pen with an e-ink screen, even slight shaking can cause click events to frequently fail. Users wanting to perform a simple "click" operation need to be extremely careful to keep the pen tip stable; even a slight hand tremor or coordinate instability due to e-ink screen display delays will prevent a successful click. This significantly reduces user experience and interaction efficiency.
[0008] Some alternatives might attempt to improve the accuracy of the electromagnetic pen or reduce display latency at the hardware level, but this involves modifications to the underlying hardware and system architecture, which are costly, complex to implement, and opaque to existing browser environments. Other solutions attempt to adjust user interaction feedback through CSS or browser configuration, but these still cannot overcome the inherent logical limitations of the browser kernel's click detection.
[0009] causation:
[0010] • Reason: The browser's native click detection relies strictly on the pointer down event and the pointer up event, which have no obvious displacement conditions.
[0011] •Results: Slight jitter becomes common in e-ink screens and electromagnetic pen environments. Existing solutions lack fault tolerance mechanisms for these micro-jitters, resulting in unresponsive clicks and events not being triggered.
[0012] In summary, in browser applications with e-ink screens, when clicking with an electromagnetic pen, device characteristics (such as e-ink screen refresh latency, input coordinate jitter, and precision limitations) and the relatively strict native event judgment logic of the browser mean that even slight pointer displacement can prevent the native click event from triggering correctly, thus reducing the sensitivity and accuracy of user interaction. The technical problem of this invention is how to establish a click event triggering scheme at the front-end application level that is tolerant of slight displacements, ensuring that users can still obtain a similar clicking experience to traditional touch or mouse environments in e-ink screen and electromagnetic pen environments, thereby improving interaction sensitivity and user satisfaction.
[0013] In view of this, this invention patent is hereby proposed. Summary of the Invention
[0014] To address the above technical problems, this invention proposes a method for handling electromagnetic pen pointer events on e-ink screen devices. This method aims to improve the sensitivity and success rate of click operations on e-ink screen devices by addressing the issue from the front-end application logic level, rather than relying on hardware or browser kernel modifications. It establishes a click event triggering mechanism that tolerates slight displacement. Specifically, the following technical solution is adopted:
[0015] In a first aspect, the present invention provides a method for processing electromagnetic pen pointer events applicable to electronic ink screen devices, characterized in that it includes:
[0016] Get the pointer down event of the electromagnetic pen pressing the screen on the e-ink screen device;
[0017] Record the initial element coordinates (startX0, startY0) of the pointer down screen event;
[0018] Monitor the state of the pointer move event during the duration of the pointer down screen press event;
[0019] When a pointer move event is detected, the distance di that the pointer has moved between its current position coordinates (currentXi, currentYi) and its initial coordinates (startX0, startY0) is calculated.
[0020] Get the pointer up event of the electromagnetic pen on the e-ink screen device and determine whether the pointer event has a movement distance di that exceeds the preset threshold Threshold;
[0021] If the result is negative, the pointer event of the electromagnetic pen on the e-ink screen device is a click operation; if the result is positive, the pointer event of the electromagnetic pen on the e-ink screen device is a non-click operation.
[0022] As an optional embodiment of the present invention, in a method for processing electromagnetic pen pointer events applicable to electronic ink screen devices, the monitoring of the state of pointer movement event pointove during the continuous pointer press screen event pointerdown includes:
[0023] When a pointer down event is detected, the pointer capture program SetPointerCapture is called to continuously capture the pointer.
[0024] The pointer capture program SetPointerCapture is initialized, and hasMovedOut = false is set to indicate that the pointer has not yet moved out of the acceptable click range, and the program enters the state of listening for pointer movement events pointermove.
[0025] As an optional embodiment of the present invention, in a method for handling electromagnetic pen pointer events applicable to electronic ink screen devices, during the process of monitoring the pointer movement event pointermove, the movement distance di between the current pointer position coordinates (currentXi, currentYi) and the initial coordinates (startX0, startY0) is calculated.
[0026] Determine whether the moving distance di exceeds the preset threshold Threshold;
[0027] If the judgment result is di>the preset threshold Threshold, then hasMovedOut=true, indicating that the judgment pointer has moved out of the acceptable click range;
[0028] If the judgment result is di≤Threshold, then hasMovedOut=false, indicating that the judgment pointer has not yet moved out of the acceptable click range.
[0029] As an optional embodiment of the present invention, a method for processing electromagnetic pen pointer events applicable to electronic ink screen devices includes:
[0030] Get the pointer up event of the electromagnetic pen on the e-ink screen device, determine whether the pointer event has a movement distance di exceeding the preset threshold Threshold, and check the value of hasMovedOut.
[0031] If hasMovedOut = false and the moving distance di ≤ the preset threshold Threshold, then the pointer event of the electromagnetic pen on the e-ink screen device is determined to be a click operation;
[0032] If hasMovedOut = true, or the movement distance di > the preset threshold Threshold, then the pointer event of the electromagnetic pen on the e-ink screen device is determined to be a non-click operation.
[0033] As an optional embodiment of the present invention, in a method for processing electromagnetic pen pointer events applicable to electronic ink screen devices, the calculation of the movement distance di between the current pointer position coordinates (currentXi, currentYi) and the initial coordinates (startX0, startY0) includes:
[0034]
[0035] Where ΔX = currentXi - startX0, ΔY = currentYi - startY0, R1 is the Manhattan distance switching threshold, and R2 is the infinite norm switching threshold.
[0036] As an optional embodiment of the present invention, in a method for handling electromagnetic pen pointer events applicable to electronic ink screen devices, the calculation process of the movement distance di includes dynamic compensation:
[0037] The actual distance to be determined is di' = di × (1 + k × v);
[0038] Where v is the instantaneous movement speed (pixel / ms), k is the speed compensation coefficient, and when the electromagnetic pen battery power is lower than the low power threshold, the value of k is increased by N%, where N is the set value.
[0039] As an optional embodiment of the present invention, in a method for processing electromagnetic pen pointer events applicable to electronic ink screen devices, when the pointer event of the electromagnetic pen on the electronic ink screen device is a click operation, a simulated click event is triggered.
[0040] Introduce a screen refresh synchronization mechanism for e-ink devices during the simulated click event confirmation phase:
[0041] The execution of the simulated click event command is delayed until the start of the next screen refresh cycle, and the delay time τ satisfies:
[0042] τ=(Trefresh-t%Trefresh);
[0043] Where Trefresh is the screen refresh cycle, and t is the timestamp of the pointer up event.
[0044] As an optional embodiment of the present invention, in a method for processing electromagnetic pen pointer events applicable to electronic ink screen devices, when the pointer lift-off event (pointerup) of the electromagnetic pen on the electronic ink screen device is obtained, the pointer capture program SetPointerCapture is called to release the pointer capture and the temporary variable is reset to prepare for the next operation.
[0045] As an optional embodiment of the present invention, in a method for handling electromagnetic pen pointer events applicable to electronic ink screen devices, after the pointer capture program SetPointerCapture is called to release the pointer capture, the last valid coordinates (X_last, Y_last) and pressure value F_last are retained.
[0046] Temporary variables include the distance traveled, di, and the speed, v, which are reset to zero exponentially: var_reset(t) = var_init × e (-t / τ) , where τ is the decay time constant and t is the time after release.
[0047] In a second aspect, the present invention provides a processing apparatus for electromagnetic pen pointer events suitable for electronic ink screen devices, comprising:
[0048] The pointer press screen event acquisition module acquires the pointer press screen event pointerdown of the electromagnetic pen on the e-ink screen device;
[0049] The initial element coordinate recording module records the initial element coordinates (startX0, startY0) of the pointer press screen event pointerdown;
[0050] The pointer capture module listens to the state of the pointer movement event pointermove during the pointer down event: when the pointer movement event pointermove is detected, it calculates the movement distance di between the current position coordinates (currentXi, currentYi) and the initial coordinates (startX0, startY0);
[0051] The pointer release module acquires the pointer release event (pointerup) of the electromagnetic pen on the e-ink screen device and determines whether the pointer event has a movement distance (di) exceeding the preset threshold (Threshold). If the determination result is no, the pointer event of the electromagnetic pen on the e-ink screen device is a click operation; if the determination result is yes, the pointer event of the electromagnetic pen on the e-ink screen device is a non-click operation.
[0052] In a third aspect, the present invention provides a computer-readable recording medium storing a computer-executable program, which, when executed, implements the method for processing electromagnetic pen pointer events applicable to electronic ink screen devices.
[0053] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0054] The present invention provides a method for handling electromagnetic pen pointer events applicable to electronic ink screen devices, which has the following technical features:
[0055] 1. Front-end layer implements fault-tolerant click detection logic for pointer events:
[0056] The core innovation of this invention, a method for handling electromagnetic pen pointer events applicable to e-ink screen devices, lies in adding a "displacement tolerance mechanism" to click events at the browser front-end level, rather than strictly relying on the browser's native click event triggering logic. By capturing and calculating the pointer press screen event (pointermove) and pointer release screen event (pointerup), this solution allows for a slight displacement (below a preset threshold) during the press and release phases when a user lightly touches the e-ink screen device with an electromagnetic pen, and still classifies the operation as a valid click.
[0057] 2. Improve click sensitivity by listening to pointer move events (pointermove) and using threshold judgment:
[0058] This invention captures pointer movement events (pointermove) to ensure complete pointer trajectory data is obtained even with slight movement after a user presses the screen. Then, during the pointer release event (pointerup), a judgment is made based on the accumulated displacement distance and a preset threshold. If the displacement distance is within the threshold and the pointer is not marked as "out of range" (hasMovedOut = false), a simulated click event is sent. This method requires no modification to the browser kernel or underlying hardware characteristics, allowing adaptation to different display and input device features at the front-end application layer.
[0059] 3. Extension and compensation of traditional strict judgment logic:
[0060] Existing browser event detection logic is strict about click conditions; once a significant displacement of the pointer between pressing and releasing is detected, the click event is no longer triggered. The key point of this invention is to extend the functionality of this traditional detection logic by adding fault-tolerant judgments on the front end and actively triggering simulated clicks when conditions are met, so that users can obtain a more natural and sensitive clicking experience in electromagnetic pen and e-ink screen environments.
[0061] In summary, the key point of the electromagnetic pen pointer event processing method for e-ink screen devices proposed in this invention is the capture and threshold calculation of pointer movement events (pointtermove), thereby implementing a click determination mechanism at the front-end application level that allows for slight displacement and compensates for defects in native events. This mechanism improves the trigger sensitivity of click events and the user experience, and is suitable for special hardware and usage environments such as electromagnetic pens and e-ink screens. Attached Figure Description
[0062] Figure 1 A flowchart of a method for handling electromagnetic pen pointer events applicable to electronic ink screen devices according to an embodiment of the present invention;
[0063] Figure 2 A timing diagram of a method for handling electromagnetic pen pointer events applicable to electronic ink screen devices according to an embodiment of the present invention;
[0064] Figure 3 A schematic diagram of the structure of the electronic device according to an embodiment of the present invention;
[0065] Figure 4 A schematic diagram of a computer-readable recording medium according to an embodiment of the present invention. Detailed Implementation
[0066] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments.
[0067] Therefore, the following detailed description of embodiments of the present invention is not intended to limit the scope of the claimed invention, but merely illustrates some embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.
[0068] It should be noted that, unless otherwise specified, the embodiments and features and technical solutions in the present invention can be combined with each other.
[0069] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.
[0070] In the description of this invention, it should be noted that the terms "upper," "lower," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings, or the orientation or positional relationship commonly used when the product of this invention is in use, or the orientation or positional relationship commonly understood by those skilled in the art. These terms are only for the convenience of describing this invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of this invention. In addition, the terms "first," "second," etc., are only used to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0071] On specialized devices such as e-ink screens, when a user lightly touches a browser interface with an electromagnetic pen, there is often a slight pointer movement. Although these minute vibrations are not the user's actual movement intention, they are enough to cause the native browser's click event detection to fail, thus preventing the expected interactive feedback from being triggered.
[0072] Reasoning: If the original judgment strictly requires that there is no obvious displacement during the pressing and lifting of the pointer, then under the high latency and jitter of electromagnetic pen interaction, the traditional click judgment will frequently fail.
[0073] Therefore, the native click event is strict: even a slight offset is treated as a non-click operation by the browser. This means that users need to be very careful when pressing and releasing the stylus vertically, otherwise they will not get a valid response.
[0074] To address the aforementioned technical issues, this embodiment proposes the following solution: adding a displacement tolerance threshold to the click determination. If the movement distance can be calculated and judged based on pointer event data at the front-end level, and the maximum displacement of the pointer between pressing and releasing is less than this threshold, even if a slight movement occurs, this behavior will still be judged as a click, thus compensating for the stringent nature of the native event determination.
[0075] See Figure 1 As shown in this embodiment, a method for handling electromagnetic pen pointer events applicable to e-ink screen devices includes:
[0076] Get the pointer down event of the electromagnetic pen pressing the screen on the e-ink screen device;
[0077] Record the initial element coordinates (startX0, startY0) of the pointer down screen event;
[0078] Monitor the state of the pointer move event during the duration of the pointer down screen press event;
[0079] When a pointer move event is detected, the distance di that the pointer has moved between its current position coordinates (currentXi, currentYi) and its initial coordinates (startX0, startY0) is calculated.
[0080] Get the pointer up event of the electromagnetic pen on the e-ink screen device and determine whether the pointer event has a movement distance di that exceeds the preset threshold Threshold;
[0081] If the result is negative, the pointer event of the electromagnetic pen on the e-ink screen device is a click operation; if the result is positive, the pointer event of the electromagnetic pen on the e-ink screen device is a non-click operation.
[0082] This embodiment of a method for handling electromagnetic pen pointer events applicable to e-ink screen devices has the following technical features:
[0083] 1. Front-end layer implements fault-tolerant click detection logic for pointer events:
[0084] The core innovation of this embodiment, which describes a method for handling electromagnetic pen pointer events applicable to e-ink screen devices, lies in adding a "displacement tolerance mechanism" to click events at the browser front-end level, rather than strictly relying on the browser's native click event triggering logic. By capturing and calculating the pointer press screen event (pointermove) and pointer release screen event (pointerup), this solution allows for a slight displacement (below a preset threshold) during the press and release phases when a user lightly touches the e-ink screen device with an electromagnetic pen, and still classifies the operation as a valid click.
[0085] 2. Improve click sensitivity by listening to pointer move events (pointermove) and using threshold judgment:
[0086] This invention captures pointer movement events (pointermove) to ensure complete pointer trajectory data is obtained even with slight movement after a user presses the screen. Then, during the pointer release event (pointerup), a judgment is made based on the accumulated displacement distance and a preset threshold. If the displacement distance is within the threshold and the pointer is not marked as "out of range" (hasMovedOut = false), a simulated click event is sent. This method requires no modification to the browser kernel or underlying hardware characteristics, allowing adaptation to different display and input device features at the front-end application layer.
[0087] 3. Extension and compensation of traditional strict judgment logic:
[0088] Existing browser event detection logic is strict about click conditions; once a significant displacement of the pointer between pressing and releasing is detected, the click event is no longer triggered. The key point of this invention is to extend the functionality of this traditional detection logic by adding fault-tolerant judgments on the front end and actively triggering simulated clicks when conditions are met, so that users can obtain a more natural and sensitive clicking experience in electromagnetic pen and e-ink screen environments.
[0089] In summary, the key point of this embodiment's method for handling electromagnetic pen pointer events applicable to e-ink screen devices is the capture and threshold calculation of pointer movement events (pointermove). This enables a click determination mechanism at the front-end application level that allows for slight displacement and compensates for defects in native events. This mechanism improves the trigger sensitivity of click events and enhances the user experience, making it suitable for specialized hardware and usage environments such as electromagnetic pens and e-ink screens.
[0090] As an optional implementation of this embodiment, in a method for handling electromagnetic pen pointer events applicable to electronic ink screen devices, the state of the pointer movement event pointermove during the continuous process of the pointer press screen event pointerdown includes:
[0091] When a pointer down event is detected, the pointer capture program SetPointerCapture is called to continuously capture the pointer.
[0092] The pointer capture program SetPointerCapture is initialized, and hasMovedOut = false is set to indicate that the pointer has not yet moved out of the acceptable click range, and the program enters the state of listening for pointer movement events pointermove.
[0093] The `SetPointerCapture` method is a mechanism provided by browsers for pointer events. After a pointer is pressed on an element, that element can capture subsequent pointer movement events (`pointermove`), pointer release events (`pointerup`), and other events on that element even if the pointer moves out of the element's bounds. This is crucial for handling input on devices with fast movement, slight offsets, and special display delays. Conversely, the `ReleasePointerCapture` method releases the previously captured pointer event.
[0094] As an optional implementation of this embodiment, in a method for handling electromagnetic pen pointer events applicable to e-ink screen devices, during the process of monitoring the pointer movement event pointermove, the movement distance di between the current pointer position coordinates (currentXi, currentYi) and the initial coordinates (startX0, startY0) is calculated.
[0095] Determine whether the moving distance di exceeds the preset threshold Threshold;
[0096] If the judgment result is di>the preset threshold Threshold, then hasMovedOut=true, indicating that the judgment pointer has moved out of the acceptable click range;
[0097] If the judgment result is di≤Threshold, then hasMovedOut=false, indicating that the judgment pointer has not yet moved out of the acceptable click range.
[0098] Furthermore, regardless of whether di exceeds the threshold, the system returns to the state of listening for the pointer move event (pointermove). As long as the user is still moving the pointer (and hasn't lifted it), the above calculation and judgment process is continuously repeated. If the user continues to move, the pointer move event (pointermove) will be triggered cyclically, repeatedly performing distance determination.
[0099] Furthermore, this embodiment provides a method for handling electromagnetic pen pointer events in electronic ink screen devices, including:
[0100] Get the pointer up event of the electromagnetic pen on the e-ink screen device, determine whether the pointer event has a movement distance di exceeding the preset threshold Threshold, and check the value of hasMovedOut.
[0101] If hasMovedOut = false and the moving distance di ≤ the preset threshold Threshold, then the pointer event of the electromagnetic pen on the e-ink screen device is determined to be a click operation;
[0102] If hasMovedOut = true, or the movement distance di > the preset threshold Threshold, then the pointer event of the electromagnetic pen on the e-ink screen device is determined to be a non-click operation.
[0103] This embodiment provides a method for handling pointer events of an electromagnetic pen on an e-ink screen device. By capturing pointer movement events (pointermove), it ensures that even slight movement after a user presses the screen can capture complete pointer trajectory data. Then, during the pointer release event (pointerup), a judgment is made based on the accumulated displacement distance and a preset threshold. If the displacement does not exceed the threshold and is not marked as "out of range," and hasMovedOut = false, a simulated click event is sent. This method does not require modification of the browser kernel or underlying hardware characteristics, and can adapt to different display and input device characteristics at the front-end application layer.
[0104] As an optional implementation of this embodiment, in the method for handling electromagnetic pen pointer events applicable to electronic ink screen devices described in this embodiment, the calculation of the movement distance di between the current pointer position coordinates (currentXi, currentYi) and the initial coordinates (startX0, startY0) includes:
[0105]
[0106] Where ΔX = currentXi - startX0, ΔY = currentYi - startY0, R1 is the Manhattan distance switching threshold (optional 3-5 pixels), and R2 is the infinity norm switching threshold (optional 15-20 pixels).
[0107] In this embodiment, the calculation of the moving distance di adopts a segmented weighted algorithm, and the optimal distance measurement method is used in different moving stages, which significantly improves the accuracy of distance calculation and environmental adaptability. In particular, it has been specially optimized for the special display characteristics of e-ink screen and the input characteristics of electromagnetic pen.
[0108] Furthermore, in a method for handling electromagnetic pen pointer events applicable to electronic ink screen devices according to this embodiment, the calculation process of the movement distance di includes dynamic compensation:
[0109] The actual distance to be determined is di' = di × (1 + k × v);
[0110] Where v is the instantaneous movement speed (pixel / ms), k is the speed compensation coefficient (optional 0.05-0.1), and when the electromagnetic pen battery power is lower than the low power threshold (optional 20%), the value of k is increased by N% (optional 30%), where N is the set value.
[0111] As an optional implementation of this embodiment, in a method for processing electromagnetic pen pointer events applicable to e-ink screen devices, when the pointer event of the electromagnetic pen on the e-ink screen device is a click operation, a simulated click event is triggered.
[0112] Introduce a screen refresh synchronization mechanism for e-ink devices during the simulated click event confirmation phase:
[0113] The execution of the simulated click event command is delayed until the start of the next screen refresh cycle, and the delay time τ satisfies:
[0114] τ=(Trefresh-t%Trefresh);
[0115] Where Trefresh is the screen refresh cycle, and t is the timestamp of the pointer up event.
[0116] Because e-ink screen devices have low screen refresh rates and refresh delays, this embodiment introduces a screen refresh synchronization mechanism for e-ink screen devices during the simulated click event confirmation stage to ensure that the simulated click event is synchronized with the screen display, thereby improving the display effect of the user's click operation.
[0117] This embodiment provides a method for handling electromagnetic pen pointer events applicable to e-ink screen devices. When the pointer lift-off event (pointerup) of the electromagnetic pen on the e-ink screen device is obtained, the pointer capture program SetPo interCapture is called to release the pointer capture and reset the temporary variable to prepare for the next operation.
[0118] Specifically, in a method for handling electromagnetic pen pointer events applicable to electronic ink screen devices in this embodiment, after calling the pointer capture program SetPointerCapture to release the pointer capture, the last valid coordinates (X_last, Y_last) and pressure value F_last are retained;
[0119] Temporary variables include the distance traveled, di, and the speed, v, which are reset to zero exponentially: var_reset(t) = var_init × e (-t / τ) , where τ is the decay time constant and t is the time after release.
[0120] See Figure 1As shown in this embodiment, a method for handling electromagnetic pen pointer events applicable to e-ink screen devices includes the following specific examples:
[0121] 1. Start (A): The process begins, the program is in standby mode, waiting for user interaction events to occur.
[0122] 2. Waiting for the pointerdown event (B): The program waits for the user to press the pointer (or other pointer) on the target element, i.e., the pointerdown event is triggered.
[0123] 3. Pointerdown Handling (C): When a pointerdown event is detected, perform the following operations: Record the initial pointer coordinates (startX, startY). Call the setPointerCapture method to ensure that subsequent movement and release events related to this pointer can be captured by the current element.
[0124] 4. Initialization state (D): Set hasMovedOut = false to indicate that the pointer has not yet moved out of the acceptable click range and enter the state of listening for the pointermove event.
[0125] 5. Listen for the pointermove event (E): The program begins to wait for the user's pointer movement operation.
[0126] 6. Calculate pointer movement distance (F): Whenever a pointermove event is received, calculate the movement distance d between the current pointer position (currentX, currentY) and the initial coordinates (startX, startY).
[0127] 7. Determine if the threshold (G) is exceeded: Compare d with the preset threshold (e.g., 10 pixels).
[0128] If d > threshold (yes): This means the pointer movement exceeds the tolerable range.
[0129] If d ≤ threshold (No): This means the pointer movement is still within acceptable limits.
[0130] 8. Pointer out of range (H): If d > threshold, set hasMovedOut to true, indicating that the pointer has moved too far from the starting point and is no longer considered a simple click behavior.
[0131] 9. Continue listening for movement (I): Regardless of whether d exceeds the threshold, return to the state of listening for pointermove. As long as the user is still moving the pointer (and has not lifted it), the above calculation and judgment process will be repeated continuously. If the user continues to move, the pointermove event will be triggered cyclically, and the distance judgment will be repeated.
[0132] 10. PointerUp Event (J): When the user finally releases the stylus (pointerup event occurs), the process proceeds to the final determination of the click behavior.
[0133] 11. Final decision (K): Check hasMovedOut and final distance d.
[0134] If hasMovedOut == false and d is within the threshold range: it means that the pointer did not move significantly from the time it was pressed to the time it was released, and it can be determined as a valid click.
[0135] Otherwise, it is considered a non-click operation (e.g., the user is actually swiping or dragging).
[0136] 12. Trigger or not trigger the click event (L / M):
[0137] If the click condition is met (yes): trigger a simulated click event (L).
[0138] If the click condition is not met (No): Do not trigger the click event (M).
[0139] 13. Cleanup and Reset (N): Call releasePointerCapture to release the pointer capture and reset the relevant temporary variables to prepare for the next operation.
[0140] 14. End (O): The entire click determination process ends, and the system returns to the initial state to wait for the next user interaction.
[0141] This embodiment provides a method for handling electromagnetic pen pointer events applicable to e-ink screen devices. By capturing pointerdown, pointermove, and pointerup events and performing distance calculation logic, the front-end application can provide a certain displacement tolerance for click events in the environment of electromagnetic pens and special display devices (such as e-ink screens), thereby improving the sensitivity and accuracy of click event triggering.
[0142] like Figure 2As shown, this embodiment illustrates a specific example of a timing diagram for a method of handling electromagnetic pen pointer events applicable to e-ink screen devices. The timing diagram demonstrates the entire process from user interaction to browser, front-end application logic processing, and final determination of the click behavior when a user performs a click operation on an e-ink screen device using an electromagnetic pen (Stylus). The following is a detailed description of the timing diagram:
[0143] 1. User actions and event propagation:
[0144] When a user taps a target element on the screen with an electromagnetic pen (pointerdown), the electromagnetic pen hardware (Stylus) reports the press location to the browser.
[0145] The browser dispatches the pointerdown event to the front-end application (App).
[0146] 2. Front-end application's response to pointerdown:
[0147] After receiving the pointerdown event, the front-end application records the initial pointer coordinates (startX, startY).
[0148] Calling setPointerCapture(pointerId) ensures that subsequent pointermove and pointerup can be captured and processed by the current element.
[0149] Set isPointerDown to true and hasMovedOut to false to prepare for subsequent pointermove monitoring.
[0150] 3. Pointer move loop:
[0151] While the user keeps the stylus pressed down and may move it slightly:
[0152] Every tiny movement by the user is reported to the browser via the electromagnetic pen hardware and triggers the pointermove event.
[0153] The browser continues to dispatch the pointermove event to the front-end application.
[0154] The front-end application calculates the movement distance d based on the current pointer coordinates (currentX, currentY) and the initial coordinates (startX, startY).
[0155] If d exceeds a preset threshold (e.g., 10 pixels), then hasMovedOut is set to true, indicating that the pointer has exceeded the acceptable range for click detection.
[0156] This process will continue until the user lifts the stylus.
[0157] 4. Pointerup phase:
[0158] When the user finally releases the electromagnetic pen:
[0159] The electromagnetic pen reports the pointerup status to the browser.
[0160] The browser dispatches the pointerup event to the front-end application.
[0161] At this point, the front-end application determines the click based on hasMovedOut and the final movement distance d.
[0162] If hasMovedOut == false and the movement distance d does not exceed the threshold, it means that the user's pen tip was basically in the same position during the pressing and lifting process, and this operation can be judged as a valid click. The front-end application actively triggers a "simulated click event" to compensate for the possibility that the browser's native events are not sensitive enough.
[0163] If hasMovedOut == true or the movement distance d exceeds the threshold, it indicates that the user may have made a significant movement or drag. This operation should not be considered a click, so a click event is not triggered.
[0164] 5. Finishing and Resetting:
[0165] After the click detection is completed, the front-end application calls releasePointerCapture(pointerId) to release the capture of the pointer and resets the state variables such as isPointerDown and hasMovedOut back to their initial values, waiting for the next user interaction.
[0166] 6. User Experience and Results:
[0167] After this process is complete, users will find that even if there is slight jitter during the electromagnetic pen's tapping, as long as it does not exceed a preset threshold range, the front-end application can still determine it as a successful click. This improves the sensitivity of click operations and the user experience in special environments such as e-ink screens.
[0168] This sequence diagram clearly illustrates how the present invention utilizes Pointer Events capture and displacement determination to improve the sensitivity and fault tolerance of click triggering by demonstrating the event flow and internal logic processing between the user, the electromagnetic pen, the browser, and the front-end application.
[0169] This embodiment also provides a device for processing electromagnetic pen pointer events suitable for electronic ink screen devices, including:
[0170] The pointer press screen event acquisition module acquires the pointer press screen event pointerdown of the electromagnetic pen on the e-ink screen device;
[0171] The initial element coordinate recording module records the initial element coordinates (startX0, startY0) of the pointer press screen event pointerdown;
[0172] The pointer capture module listens to the state of the pointer movement event pointermove during the pointer down event: when the pointer movement event pointermove is detected, it calculates the movement distance di between the current position coordinates (currentXi, currentYi) and the initial coordinates (startX0, startY0);
[0173] The pointer release module acquires the pointer release event (pointerup) of the electromagnetic pen on the e-ink screen device and determines whether the pointer event has a movement distance (di) exceeding the preset threshold (Threshold). If the determination result is no, the pointer event of the electromagnetic pen on the e-ink screen device is a click operation; if the determination result is yes, the pointer event of the electromagnetic pen on the e-ink screen device is a non-click operation.
[0174] This embodiment provides a processing device for electromagnetic pen pointer events applicable to e-ink screen devices. The key aspect is the capture and threshold calculation of pointer movement events (pointermove), thereby implementing a click determination mechanism at the front-end application level that allows for slight displacement and compensates for defects in native events. This mechanism improves the trigger sensitivity of click events and enhances the user experience, making it suitable for specialized hardware and usage environments such as electromagnetic pens and e-ink screens.
[0175] The following describes embodiments of the electronic device of the present invention, which can be considered as specific implementations of the methods and apparatus embodiments of the present invention described above. Details described in the embodiments of the electronic device of the present invention should be considered as supplements to the methods or apparatus embodiments described above; details not disclosed in the embodiments of the electronic device of the present invention can be implemented with reference to the methods or apparatus embodiments described above.
[0176] Figure 3 This is a schematic diagram of the structure of an electronic device according to an embodiment of the present invention. The electronic device includes a processor and a memory. The memory is used to store a computer-executable program. When the computer program is executed by the processor, the processor executes a method for processing electromagnetic pen pointer events applicable to an electronic ink screen device according to an embodiment of the present invention.
[0177] like Figure 3 As shown, the electronic device is embodied in the form of a general-purpose computing device. There can be one or more processors working collaboratively. This invention also does not preclude distributed processing, meaning that processors can be distributed across different physical devices. The electronic device of this invention is not limited to a single entity, but can also be the sum of multiple physical devices.
[0178] The memory stores a computer-executable program, typically machine-readable code. The computer-readable program can be executed by the processor to enable the electronic device to perform the method of the present invention, or at least some steps of the method.
[0179] The memory includes volatile memory, such as random access memory (RAM) and / or cache memory, and may also be non-volatile memory, such as read-only memory (ROM).
[0180] Optionally, in this embodiment, the electronic device further includes an I / O interface for exchanging data with external devices. The I / O interface can represent one or more of several bus structures, including a memory cell bus or memory cell controller, a peripheral bus, a graphics acceleration port, a processing unit, or a local bus using any of the various bus structures.
[0181] It should be understood that Figure 3 The electronic device shown is merely one example of the present invention, and the electronic device of the present invention may also include elements or components not shown in the above examples. For example, some electronic devices also include display units such as displays, and some electronic devices also include human-computer interaction elements such as buttons and keyboards. Any electronic device capable of executing a computer-readable program in memory to implement the method of the present invention or at least some steps of the method can be considered as an electronic device covered by the present invention.
[0182] Figure 4 This is a schematic diagram of a computer-readable recording medium according to an embodiment of the present invention. Figure 4As shown, a computer-readable recording medium stores a computer-executable program. When executed, the computer-executable program implements a method for processing electromagnetic pen pointer events applicable to an electronic ink screen device according to an embodiment of the present invention. The computer-readable recording medium may include data signals propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The readable recording medium may also be any readable medium other than a readable recording medium, capable of sending, propagating, or transmitting programs for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the readable recording medium can be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.
[0183] Program code for performing the operations of this invention can be written in any combination of one or more programming languages, including object-oriented programming languages such as Java and C++, and conventional procedural programming languages such as C or similar languages. The program code can execute entirely on the user's computing device, partially on the user's device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0184] From the above description of the embodiments, those skilled in the art will readily understand that the present invention can be implemented by hardware capable of executing specific computer programs, such as the system of the present invention, and the electronic processing unit, server, client, mobile phone, control unit, processor, etc. included in the system. The present invention can also be implemented by computer software executing the methods of the present invention, for example, by control software executed by a microprocessor, electronic control unit, client, server, etc. However, it should be noted that the computer software executing the methods of the present invention is not limited to execution in one or a specific set of hardware entities; it can also be implemented in a distributed manner by unspecified hardware. For computer software, the software product can be stored on a computer-readable recording medium (such as a CD-ROM, USB flash drive, portable hard disk, etc.) or distributed across a network, as long as it enables electronic devices to execute the methods according to the present invention.
[0185] The above embodiments are only used to illustrate the present invention and are not intended to limit the technical solutions described herein. Although the present invention has been described in detail with reference to the above embodiments, the present invention is not limited to the specific embodiments described above. Therefore, any modifications or equivalent substitutions to the present invention, as well as all technical solutions and improvements that do not depart from the spirit and scope of the invention, are covered within the scope of the claims of the present invention.
Claims
1. A method for handling electromagnetic pen pointer events in electronic ink screen devices, characterized in that, include: Get the pointer down event of the electromagnetic pen pressing the screen on the e-ink screen device; Record the initial element coordinates (startX0, startY0) of the pointer down screen event; Monitor the state of the pointer move event during the duration of the pointer down screen press event; When a pointer move event is detected, the distance di that the pointer has moved between its current position coordinates (currentXi, currentYi) and its initial coordinates (startX0, startY0) is calculated. Get the pointer up event of the electromagnetic pen on the e-ink screen device and determine whether the pointer event has a movement distance di that exceeds the preset threshold Threshold; If the result is negative, the pointer event of the electromagnetic pen on the e-ink screen device is a click operation; if the result is positive, the pointer event of the electromagnetic pen on the e-ink screen device is a non-click operation.
2. The method for handling electromagnetic pen pointer events in electronic ink screen devices according to claim 1, characterized in that, The state of the pointer move event during the continuous period of the pointer down screen press event includes: When a pointer down event is detected, the pointer capture program SetPointerCapture is called to continuously capture the pointer. The pointer capture program SetPointerCapture is initialized, and hasMovedOut = false is set to indicate that the pointer has not yet moved out of the acceptable click range, and the program enters the state of listening for pointer movement events pointermove.
3. The method for processing electromagnetic pen pointer events in electronic ink screen devices according to claim 2, characterized in that, During the state monitoring of the pointer move event pointermove, the movement distance di between the current pointer position coordinates (currentXi, currentYi) and the initial coordinates (startX0, startY0) is calculated. Determine whether the moving distance di exceeds the preset threshold Threshold; If the judgment result is di>the preset threshold Threshold, then hasMovedOut=true, indicating that the judgment pointer has moved out of the acceptable click range; If the judgment result is di≤Threshold, then hasMovedOut=false, indicating that the judgment pointer has not yet moved out of the acceptable click range.
4. The method for handling electromagnetic pen pointer events in electronic ink screen devices according to claim 3, characterized in that, include: Get the pointer up event of the electromagnetic pen on the e-ink screen device, determine whether the pointer event has a movement distance di exceeding the preset threshold Threshold, and check the value of hasMovedOut. If hasMovedOut = false and the moving distance di ≤ the preset threshold Threshold, then the pointer event of the electromagnetic pen on the e-ink screen device is determined to be a click operation; If hasMovedOut = true, or the movement distance di > the preset threshold Threshold, then the pointer event of the electromagnetic pen on the e-ink screen device is determined to be a non-click operation.
5. A method for processing electromagnetic pen pointer events in electronic ink screen devices according to any one of claims 1-3, characterized in that, The calculation of the movement distance di between the current position coordinates (currentXi, currentYi) and the initial coordinates (startX0, startY0) of the pointer includes: Where ΔX = currentXi - startX0, ΔY = currentYi - startY0, R1 is the Manhattan distance switching threshold, and R2 is the infinite norm switching threshold.
6. The method for processing electromagnetic pen pointer events in electronic ink screen devices according to claim 5, characterized in that, The calculation process for the movement distance di includes dynamic compensation: The actual distance to be determined is di' = di × (1 + k × v); Where v is the instantaneous movement speed (pixel / ms), k is the speed compensation coefficient, and when the electromagnetic pen battery power is lower than the low power threshold, the value of k is increased by N%, where N is the set value.
7. A method for processing electromagnetic pen pointer events in electronic ink screen devices according to any one of claims 1-3, characterized in that, When the pointer event of the electromagnetic pen on the e-ink screen device is a click operation, a simulated click event is triggered; Introduce a screen refresh synchronization mechanism for e-ink devices during the simulated click event confirmation phase: The execution of the simulated click event command is delayed until the start of the next screen refresh cycle, and the delay time τ satisfies: τ=(Trefresh-t%Trefresh); Where Trefresh is the screen refresh cycle, and t is the timestamp of the pointer up event.
8. A method for processing electromagnetic pen pointer events in electronic ink screen devices according to any one of claims 1-3, characterized in that, When the pointer lift-off event (pointerup) of the electromagnetic pen on the e-ink screen is obtained, the pointer capture program SetPointerCapture is called to release the pointer capture and reset the temporary variable to prepare for the next operation.
9. A method for processing electromagnetic pen pointer events in electronic ink screen devices according to claim 8, characterized in that, After the pointer capture program SetPointerCapture is called to release the pointer capture, the last valid coordinates (X_last, Y_last) and pressure value F_last are retained. Temporary variables include the distance traveled, di, and the speed, v, which are reset to zero exponentially: var_reset(t) = var_init × e (-t / τ) , where τ is the decay time constant and t is the time after release.
10. A device for processing electromagnetic pen pointer events in electronic ink screen devices, characterized in that, include: The pointer press screen event acquisition module acquires the pointer press screen event pointerdown of the electromagnetic pen on the e-ink screen device; The initial element coordinate recording module records the initial element coordinates (startX0, startY0) of the pointer press screen event pointerdown; The pointer capture module listens to the state of the pointer movement event pointermove during the pointer down event: when the pointer movement event pointermove is detected, it calculates the movement distance di between the current position coordinates (currentXi, currentYi) and the initial coordinates (startX0, startY0); The pointer release module acquires the pointer release event pointerup of the electromagnetic pen on the e-ink screen device and determines whether the pointer event has a movement distance di exceeding the preset threshold Threshold. If the result is negative, the pointer event of the electromagnetic pen on the e-ink screen device is a click operation; if the result is positive, the pointer event of the electromagnetic pen on the e-ink screen device is a non-click operation.
11. A computer-readable recording medium storing a computer-executable program, characterized in that, When the computer executable program is executed, it implements the method for processing electromagnetic pen pointer events applicable to electronic ink screen devices as described in any one of claims 1-9.
Citation Information
Patent Citations
Operation identification method and device, touch operation method and electronic equipment
CN117008806A
Data input device
JP1993158608A
Method for determining clicking operations on touch panels and devices for realizing the same
TW200832197A