Send mouse click position on drawingAreaControl

Change-Id: I92dd6ada3a1179fe63fea428e554a7e490ca3c67
Signed-off-by: mert <mert.tumer@collabora.com>
This commit is contained in:
mert 2020-12-16 23:10:48 +03:00 committed by Szymon Kłos
parent 8789130e06
commit afa2ccd6df

View file

@ -2073,10 +2073,21 @@ L.Control.JSDialogBuilder = L.Control.extend({
var span = L.DomUtil.create('span', 'ui-drawing-area-placeholder', spanContainer);
span.innerText = data.text;
}
L.DomEvent.on(image, 'click touchend', function(e) {
var x = 0;
var y = 0;
$(container).click(function () {
builder.callback('drawingarea', 'click', container, null, builder);
});
if (e.offsetX) {
x = e.offsetX;
y = e.offsetY;
} else if (e.changedTouches && e.changedTouches.length) {
x = e.changedTouches[e.changedTouches.length-1].pageX - $(image).offset().left;
y = e.changedTouches[e.changedTouches.length-1].pageY - $(image).offset().top;
}
var coordinates = (x / image.offsetWidth) + ';' + (y / image.offsetHeight);
builder.callback('drawingarea', 'click', container, coordinates, builder);
}, this);
}
return false;
},