DEV Community

Cover image for vscode scrubbing
Maia Taewana
Maia Taewana

Posted on

2 2

vscode scrubbing

scrubbing experiment

the cursor is locked during drag operation and is hidden

This is a small proof-of-concept for the VSCode extension. Scrubbing is a required part of live shader coding and it was important to have this part working with the current VSCode API and WebView limitations.

// This is the code that computes the new value
// from the scrubbing distance. It is meant to allow
// very small and very large changes in value.
// (POW: 5, BIG: 100, FAR: 400, MAX_RES: 6, POW_RES: 3, FAR_RES: 100)
const big = isFloat ? BIG : BIG * 10
const delta = Math.pow(dist / FAR, POW)
const value = base + delta * big
const resol = MAX_RES / Math.max(1, Math.abs(Math.pow(dist / FAR_RES, POW_RES)))
const [a,b] = value.toString().split('.')
element.innerHTML = isFloat ? `${a}.${(b || '0').slice(0, resol)}` : a
Enter fullscreen mode Exit fullscreen mode

Source: vscode-tuitui

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (0)

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay