New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@atomico/use-drag-resize

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@atomico/use-drag-resize - npm Package Compare versions

Comparing version 1.0.1-beta to 1.0.2-beta

2

dist/index.d.ts
import { Ref } from "atomico";
export declare function useDragResize(ref: Ref, rootState?: number[]): [boolean, number, number];
export declare function useDragResize(ref: Ref, refParent: Ref, rootState?: number[]): [boolean, number, number];

@@ -1,6 +0,5 @@

import { useState, useHost, useEffect } from "atomico";
import { useDebounceState } from "@atomico/use-debounce-state";
import { useListener } from "@atomico/use-listener";
import { useDebounceState } from "@atomico/use-debounce-state";
export function useDragResize(ref, rootState = [1, 1]) {
const host = useHost();
import { useEffect, useState } from "atomico";
export function useDragResize(ref, refParent, rootState = [1, 1]) {
const [active, setActive] = useState(false);

@@ -12,12 +11,12 @@ const [[x, y], setValue] = useDebounceState(1, rootState, "fps");

useListener(ref, "mousedown", start);
useListener(host, "mouseup", end);
useListener(host, "mouseleave", end);
useListener(refParent, "mouseup", end);
useListener(refParent, "mouseleave", end);
useListener(ref, "touchstart", start);
useListener(host, "touchend", end);
useListener(host, "touchmove", (event) => {
useListener(refParent, "touchend", end);
useListener(refParent, "touchmove", (event) => {
const { targetTouches: [touche], } = event;
const rect = host.current.getBoundingClientRect();
const rect = refParent.current.getBoundingClientRect();
const offsetX = touche.pageX - rect.x;
const offsetY = touche.pageY - rect.y;
const { current } = host;
const { current } = refParent;
setValue([

@@ -28,5 +27,5 @@ offsetX / current.clientWidth,

});
useListener(host, "mousemove", (event) => {
useListener(refParent, "mousemove", (event) => {
if (active) {
const { current } = host;
const { current } = refParent;
setValue([

@@ -33,0 +32,0 @@ event.offsetX / current.clientWidth,

{
"name": "@atomico/use-drag-resize",
"description": "Series of utilities in hooks format to extend the operation of Atomico",
"version": "1.0.1-beta",
"version": "1.0.2-beta",
"type": "module",

@@ -6,0 +6,0 @@ "author": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc