Comments (6)
Hello,
Yes, you can use any DOM event as a listener, just add it to the compiledListeners
property of your tool.
var myTool = {
"name": "MyNewTool",
"shortcut": "m",
"listeners": {
"press": startLine,
"move": continueLine,
"release": stopLineAt,
},
"compiledListeners": {
"dblclick": myListener
}, ...
For hover, I would use the existing move listener, though. See for instance the eraser.
The relevant part of the code you may want to read is here : https://github.com/lovasoa/whitebophir/blob/master/client-data/js/board.js#L497-L513
edit : fixed example. The property name iscompiledListeners
, not computedListeners
from whitebophir.
Hello, thank you for your response, I added 'click' listener to the tool, but when I click after selecting the tool, even listener is not triggered.
from whitebophir.
If you publish your fork, I'll have a look at it if you want.
from whitebophir.
function myListener(){
console.log('in click listener')
}
Tools.add({
//The new tool
name: "Resize Element",
icon: "✥✥",
shortcut: "R",
computedListeners: {
click: myListener
},
listeners: {
press: press,
move: move,
release: release
},
//draw: draw, //save move text to server
mouseCursor: "crosshair"
});
from whitebophir.
It should be compiledListeners not computedListeners
from whitebophir.
Oh, I see. I wrote the right name in my message above, but made a mistake in the example.
from whitebophir.
Related Issues (20)
- Keyboard Shortcuts HOT 2
- How delete a board? HOT 1
- Note: There is now a Sandstorm package for this app! HOT 4
- Linting and Formatting HOT 5
- Formatting and Add formatting to CI workflow HOT 3
- Implement ESLint to the project and resolve the ESLint errors HOT 13
- Docker WBO KO sur Synology HOT 8
- Run on Public IP Address HOT 1
- Pen/tablet pressure support
- The whiteboard is freezing sometimes if selected items
- After moving the screen, writing renders incorrect.
- From a certain size, the whiteboard becomes too slow to handle. HOT 1
- Is there a way to disable the public board? HOT 2
- Board "pages" HOT 1
- Adding option for default color HOT 1
- Set default tool as ENV or URL-parameter HOT 1
- Shortcut for changing the size of the line is ambiguous. HOT 1
- Impossible to write with the pencil tool inside a partly deleted ellipsis with "Chrome"
- Printing differences among browsers
- Whiteboard is not always synchronized.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from whitebophir.