Added click and mousedown event

Added minified JS file
This commit is contained in:
Ray 2023-10-08 15:57:22 +01:00
parent 59a2fec639
commit 0adf438a62
3 changed files with 40 additions and 4 deletions

View File

@ -264,8 +264,23 @@ class BBTimeline {
if (a.Debug) console.log(event);
a.OnEventClick(this, e, event);
a.OnMouseDown(this, e, event);
});
a.ctx.canvas.addEventListener('click', function (e) {
if (!a.Enabled) {
return;
}
var event = a.FindEventsByCoords(e.offsetX, e.offsetY);
if (event == null) {
return;
}
if (a.Debug) console.log(event);
a.OnClick(this, e, event);
});
}
Invalidate(redrawAxis, redrawMarkers) {
@ -381,7 +396,10 @@ class BBTimeline {
return result;
}
OnEventClick(sender, e, event) {
OnMouseDown(sender, e, event) {
}
OnClick(sender, e, event) {
}

5
bbtimeline.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -124,8 +124,21 @@ textarea {
<script>
var timeline1 = new BBTimeline("myCanvas");
timeline1.OnEventClick = function(sender, e, event) {
// console.log(e);
timeline1.OnMouseDown = function(sender, e, event) {
LogInfo("");
LogInfo("OnMouseDown");
LogInfo(JSON.stringify(sender));
LogInfo(JSON.stringify(e));
LogInfo(JSON.stringify(event));
LogInfo("");
}
timeline1.OnClick = function(sender, e, event) {
LogInfo("");
LogInfo("OnClick");
LogInfo(JSON.stringify(sender));
LogInfo(JSON.stringify(e));
LogInfo(JSON.stringify(event));
LogInfo("");
}
SetToday();