qmk_firmware/assets/features_digitizer.md.DGIGZFVx.js

16 lines
9.1 KiB
JavaScript
Raw Normal View History

import { _ as _export_sfc, c as createElementBlock, o as openBlock, a8 as createStaticVNode } from "./chunks/framework.DyMmIvSC.js";
const __pageData = JSON.parse('{"title":"Digitizer","description":"","frontmatter":{},"headers":[],"relativePath":"features/digitizer.md","filePath":"features/digitizer.md"}');
const _sfc_main = { name: "features/digitizer.md" };
const _hoisted_1 = /* @__PURE__ */ createStaticVNode('<h1 id="digitizer" tabindex="-1">Digitizer <a class="header-anchor" href="#digitizer" aria-label="Permalink to &quot;Digitizer {#digitizer}&quot;"></a></h1><p>Digitizers allow the mouse cursor to be placed at absolute coordinates, unlike the <a href="./pointing_device">Pointing Device</a> feature which applies relative displacements.</p><p>This feature implements a stylus device with a tip switch and barrel switch (generally equivalent to the primary and secondary mouse buttons respectively). Tip pressure is not currently implemented.</p><h2 id="usage" tabindex="-1">Usage <a class="header-anchor" href="#usage" aria-label="Permalink to &quot;Usage {#usage}&quot;"></a></h2><p>Add the following to your <code>rules.mk</code>:</p><div class="language-make vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">make</span><pre class="shiki shiki-themes github-light github-dark vp-code"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">DIGITIZER_ENABLE = yes</span></span></code></pre></div><h2 id="positioning" tabindex="-1">Positioning <a class="header-anchor" href="#positioning" aria-label="Permalink to &quot;Positioning {#positioning}&quot;"></a></h2><p>The X and Y coordinates are normalized, meaning their value must be set between 0 and 1. For the X component, the value <code>0</code> is the leftmost position, whereas the value <code>1</code> is the rightmost position. Similarly for the Y component, <code>0</code> is at the top and <code>1</code> at the bottom.</p><div class="tip custom-block"><p class="custom-block-title">TIP</p><p>Since there is no display attached, the OS will likely map these coordinates to the virtual desktop. This may be important to know if you have multiple monitors.</p></div><h2 id="examples" tabindex="-1">Examples <a class="header-anchor" href="#examples" aria-label="Permalink to &quot;Examples {#examples}&quot;"></a></h2><p>This example simply places the cursor in the middle of the screen:</p><div class="language-c vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">c</span><pre class="shiki shiki-themes github-light github-dark vp-code"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">digitizer_in_range_on</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">();</span></span>\n<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">digitizer_set_position</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">0.5</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">0.5</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">);</span></span></code></pre></div><p>The &quot;in range&quot; indicator is required to be on for the change in coordinates to be taken. It can then be turned off again to signal the end of the digitizer interaction, but it is not strictly required.</p><p>You can also modify the digitizer state directly, if you need to change multiple fields in a single report:</p><div class="language-c vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">c</span><pre class="shiki shiki-themes github-light github-dark vp-code"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">digitizer_state.in_range </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> true</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">;</span></span>\n<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">digitizer_state.dirty </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> true</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">;</span></span>\n<span class="line"><s
const _hoisted_48 = [
_hoisted_1
];
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return openBlock(), createElementBlock("div", null, _hoisted_48);
}
const digitizer = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
export {
__pageData,
digitizer as default
};