Very early stage of work in progress.
To create a standalone cropping tool module, consisting of three layers, stacked in the following order:
Comprising an image that scales and responds via style.translate to manipulations in the cropping layer.
Represents the translation of the cropping layer coordinates over the underlying source image
Resizable rectangle, whose dimensions scale and translate the animation layer.
The scaled { x, y, width, height } of the image that appears within the boundaries of the cropping tool is mapped to the source image.
Using the source data, we map a scaled version to the canvas layer
The scaling math between the animation layer, which uses CSS3 transform: scale, translate, and rotate and the working layer is the bit that will take the most time. At least for me. Ratio and reverse scaling calculations need to be written and probably unit tested as well.
- Create (b) image and (c) cropping area layers
- Define basic data structure and flow What does our tool need to know about the world, and what data does it need to make available
- Plugin crop handle events, and boundary calculations
- Image layer drag
- Scaling/ratio calc and functionality
- Constraints and aspect ratios
- Reflection
- Rotation tool and algorithm.
- Image getter service. A simple XHR call to get the message and handle callback and errors.
- Image exporter handling (canvasToBlob with associated MimeTypes)
- Reset functionality
- Keyboard accessibility Arrow keys should resize crop area
Implement granular rotation
npm install
npm run webpack
New terminal window:
npm start
http://localhost:8888/src/index.html
- Create image (animation) layer, canvas (working layer), and drag layer.
- Create draggable crop areas with shift
- Implement scaling/ratios
- Implement rotate
- Implement mirror