
Security News
TypeScript is Porting Its Compiler to Go for 10x Faster Builds
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
@hscmap/inertial-mouse
Advanced tools
Inertial Mouse for TypeScript * Wraps native MouseEvent and emit pseudo mousemove events with inertial smooth motion. * [Working Demo](https://michitaro.github.io/inertial-mouse)
Inertial Mouse for TypeScript
npm instasll --save @hscmap/inertial-mouse
import { InertialMouse, V2 } from "@hscmap/inertial-mouse"
window.addEventListener('load', e => {
const sandbox = document.querySelector('.sandbox') as HTMLElement
const cursor = document.querySelector('.cursor') as HTMLElement
const dxText = document.querySelector('[name="dx"]') as HTMLInputElement
const dyText = document.querySelector('[name="dy"]') as HTMLInputElement
function setCursorPosition(r: V2) {
cursor.style.left = `${r.x}px`
cursor.style.top = `${r.y}px`
}
const im = new InertialMouse(sandbox, {
down: (e) => {
setCursorPosition(e.r)
cursor.classList.add('pressed')
},
up: () => {
cursor.classList.remove('pressed')
},
move: (e) => {
setCursorPosition(e.r)
dxText.value = `${e.d.x}`
dyText.value = `${e.d.y}`
},
movestart: () => cursor.classList.add('moving'),
moveend: () => cursor.classList.remove('moving'),
})
document.addEventListener('keydown', e => im.stop())
document.addEventListener('change', e => {
const target = e.target as HTMLInputElement
if (target.matches('[name="slick"]'))
im.physics.slick = target.checked
if (target.matches('[name="friction"]'))
im.physics.friction = Number(target.value)
if (target.matches('[name="k"]'))
im.physics.k = Number(target.value)
})
})
document.addEventListener('selectstart', e => e.preventDefault()) // disable selection```
FAQs
Inertial Mouse for TypeScript * Wraps native MouseEvent and emit pseudo mousemove events with inertial smooth motion. * [Working Demo](https://michitaro.github.io/inertial-mouse)
We found that @hscmap/inertial-mouse demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.