Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function drawRect(position) {
- ctx.beginPath();
- // draw a new rect from the start position
- // to the current mouse position
- ctx.strokeRect(dragStartLocation.x, dragStartLocation.y, Math.abs(dragStartLocation.x - position.x), Math.abs(dragStartLocation.y - position.y)); //- Stian: Her settes stroke pƄ figuren
- ctx.fillRect(dragStartLocation.x, dragStartLocation.y, Math.abs(dragStartLocation.x - position.x), Math.abs(dragStartLocation.y - position.y));
- }
- // Event for mouse move
- function mouseMove(aEvent) {
- var pos = getMousePos(aEvent);
- var position;
- if (dragging === true && selectedShape === "Rectangle") {
- restoreSnapshot();
- position = pos;
- drawRect(position);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement