@egjs/axes

中文文档
3.9.3发布于 2026/09/16MITTypeScriptESM + CJS近 30 天下载 15.2万

A module used to change the information of user action entered by various input devices such as touch screen or mouse into the logical virtual coordinates. You can easily create a UI that responds to user actions.

原始使用文档
文档目录11 节
  1. Demo / Documentation / Other components
  2. ✨ Features
  3. ⚙️ Installation
  4. 🏃 Quick Start
  5. 🌐 Supported Browsers
  6. 🔧 Dependency
  7. 📼 Demos
  8. 📖 Documentation
  9. 🙌 Contributing
  10. 📝 Feedback & Bug Report
  11. 📜 License

Axes Logo
@egjs/axes

version npm weekly downloads npm bundle size (scoped) Run tests Coveralls github

Demo / Documentation / Other components

You can easily create a UI that responds to user actions.


✨ Features

⚙️ Installation

npm

$ npm install @egjs/axes

CDN

🏃 Quick Start

1. Set up your HTML

<div id="area"></div>

2. Load files or import library

ES5
<script src="https://naver.github.io/egjs-axes/release/latest/axes.pkgd.js"></script>
var Axes = eg.Axes;
var PanInput = Axes.PanInput;
var PinchInput = Axes.PinchInput;
var WheelInput = Axes.WheelInput;
var MoveKeyInput = Axes.MoveKeyInput;
ES6+
import Axes, {PanInput, PinchInput, WheelInput, MoveKeyInput} from "@egjs/axes";

3. Initialize Axes

// create eg.Axes with option
const axes = new Axes({
  something1: { range: [0, 100] },
  something2: { range: [0, 100] },
  somethingN: { range: [-200, 200] }
});

4. Attach event handlers

axes.on({
 "change": evt => /* ... */
});

5. Initialize InputTypes to use

const panInput = new PanInput("#area");
const wheelInput = new WheelInput("#wArea");
const pinchInput = new PinchInput("#pArea");
const movekeyInput = new MoveKeyInput("#mArea");

6. Connect eg.Axes and InputTypes

axes.connect(["something2", "somethingN"], panInput);
axes.connect(["something1"], wheelInput);
axes.connect(["something2"], pinchInput);
axes.connect(["something1", "something2"], movekeyInput);

7. Enjoy!

You can change the value of the axis through touch screen, mouse or anything else.

🌐 Supported Browsers

IEChromeFirefoxSafariiOSAndroid
10+LatestLatestLatest7+2.3+(except 3.x)

🔧 Dependency

egjs-axes has the dependencies for the following libraries:

eg.Componenteg.Agent
3.0.1+2.2.1+

📼 Demos

Check our Demos.

📖 Documentation

See Documentation page.

🙌 Contributing

See CONTRIBUTING.md.

📝 Feedback & Bug Report

Please file an Issue.

📜 License

@egjs/axes is released under the MIT license.

Copyright (c) 2015 NAVER Corp.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

      

版本与发布记录

@egjs/axes 共发布 82 个版本,首次发布于 2017/07/10;过去 12 个月发布了 2 个版本。

版本发布日期距今
3.9.3latest2026/09/161 个月前
3.9.3-beta.0beta2026/09/082 个月前
3.9.22025/06/051.4 年前
3.9.2-beta.02025/04/101.6 年前
3.9.12024/07/312 年前
3.9.1-beta.02024/07/302 年前

关于 @egjs/axes 的常见问题

@egjs/axes 是什么?

A module used to change the information of user action entered by various input devices such as touch screen or mouse into the logical virtual coordinates. You can easily create a UI that responds to user actions.

如何安装 @egjs/axes?

在项目目录运行 npm install @egjs/axes,或使用 pnpm add / yarn add / bun add。

@egjs/axes 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@egjs/axes 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@egjs/axes 可以商用吗?

@egjs/axes 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@egjs/axes 的下载量有多少?

根据 npm 官方下载统计,@egjs/axes 在 2026/10/13 – 2026/11/11 这 30 天内被下载 151,649 次,日均约 5,055 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@egjs/axes 还在维护吗?

最新版本 3.9.3 发布于 2026/09/16(1 个月前);至今共发布 82 个版本,其中过去 12 个月发布了 2 个;首次发布于 2017/07/10。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。