- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to handle mousedown and mouseup with HTML5 Canvas
To handle the mousedown and mouseup event with HTML5 Canvas,
var mouseDown = false; // for mousedown canvas1.onmousedown = function(event){ dragOffset.x = event.x - mainLayer.trans.x; dragOffset.y = event.y - mainLayer.trans.y; mouseDown = true; } // for mouseup canvas1.onmouseup = function(event){ if(mouseDown) mouseClick(eevent mouseDown = false; }
Advertisements