Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shakyshane/norman.js
Low-level value mapping
https://github.com/shakyshane/norman.js
Last synced: about 1 month ago
JSON representation
Low-level value mapping
- Host: GitHub
- URL: https://github.com/shakyshane/norman.js
- Owner: shakyShane
- License: mit
- Created: 2014-05-30T07:24:37.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-06-13T19:58:24.000Z (over 10 years ago)
- Last Synced: 2024-11-11T13:49:32.592Z (about 2 months ago)
- Language: JavaScript
- Size: 199 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE-MIT
Awesome Lists containing this project
README
# Norman.js [![Build Status](https://travis-ci.org/shakyShane/norman.js.svg?branch=master)](https://travis-ci.org/shakyShane/norman.js)
Use x, y coordinates to map the position of 1 element onto another.
Use it as the basis for any image-zoom type libs.###Example
```js
// The container
var viewBox = {
height: 300,
width: 300,
x: 0,
y: 0
};// The image or whatever.
var subject = {
height: 400,
width: 400
};mapper = new Norman({viewBox: viewBox}).mapTo(subject);
document.addEventListener("mousemove", function (event) {
var newPosition = mapper.map(event.clientX, event.clientY);
console.log(newPosition) => { x: 120, y: 200 }
});```
## License
Copyright (c) 2014 Shane Osbourne
Licensed under the MIT license.