# image_scale_drag

> 支持图片放大、缩小、拖拽、选点画线

Latest version **0.1.2** (published 2023-01-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install image_scale_drag
pnpm add image_scale_drag
yarn add image_scale_drag
bun add image_scale_drag
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2023-01-12 |
| First published | 2023-01-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=10 |
| Dependencies | 1 |
| Unpacked size | 114.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | maojian |
| Maintainers | maojian |

## Links

- npm: https://www.npmjs.com/package/image_scale_drag
- npm.io page: https://npm.io/package/image_scale_drag

## Dependencies (1)

- [antd](https://npm.io/package/antd.md) ^5.1.4

## Recent versions

- 0.1.2 (latest) — 2023-01-12
- 0.1.1 — 2023-01-11
- 0.1.0 — 2023-01-11
- 0.0.9 — 2023-01-11
- 0.0.8 — 2023-01-11
- 0.0.7 — 2023-01-11
- 0.0.6 — 2023-01-10
- 0.0.5 — 2023-01-10
- 0.0.4 — 2023-01-10
- 0.0.3 — 2023-01-10
- 0.0.2 — 2023-01-10
- 0.0.1 — 2023-01-05

## README

# image_scale_drag

支持图片放大、缩小、拖拽、选点画线

## 参数

### setPoints: (e: [x:number,y:number]) => void;
设置点数据
### url: string;
设置图片
### testZoomKey: number;
设置清除key
### lintColor?: string;
设置线颜色
### lintThick?: number;
设置线宽
### circleColor?: string;
设置点颜色
### circleRadius?: number;
设置点半径

### 传入的宽高已经被去做掉，现在根据外层元素自动计算宽高

> 其他功能后续添加



## 示例

```
import React, { memo, useRef, useState } from "react";
import "./index.less";
import { DotExtract } from "image_scale_drag";

import url from "../assets/images/111.jpg";

type IPoint = {
  x: number;
  y: number;
};

const Extracts: React.FC = () => {
  const [points, setPoints] = useState<IPoint[]>([]);
  const [testZoomKey, setTestZoomKey] = useState(0);
  const resert = () => {
    setTestZoomKey(testZoomKey + 1);
    setPoints([]);
  };

  return (
    <div className="wrapper">
      <DotExtract setPoints={setPoints} url={url} testZoomKey={testZoomKey} />
      <button onClick={resert}>重置</button>
      {points.map((el) => {
        return (
          <span key={el.x}>
            x: {el.x} -- y: {el.y}{" "}
          </span>
        );
      })}
    </div>
  );
};

export default memo(Extracts);
```

---
_Source: https://npm.io/package/image_scale_drag · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
