andyhill Posted January 5, 2019 Share Posted January 5, 2019 Please show how to add Mouse Click (tap) listener and retrieve X,Y Position on Canvas. Link to comment Share on other sites More sharing options...
Sherzod Posted January 5, 2019 Share Posted January 5, 2019 Hi, 19 hours ago, andyhill said: retrieve X,Y Position on Canvas Do you mean coordinates in the UnimImage area? Link to comment Share on other sites More sharing options...
andyhill Posted January 5, 2019 Author Share Posted January 5, 2019 Yes, real X,Y on Image canvas irrespective of zoom Link to comment Share on other sites More sharing options...
Sherzod Posted January 5, 2019 Share Posted January 5, 2019 36 minutes ago, andyhill said: Yes, real X,Y on Image canvas irrespective of zoom Maybe something like this? 1. UnimImage1 -> ClientEvents -> UniEvents -> function afterCreate: function afterCreate(sender) { sender.element.on("tap", function(e) { point=e.touch.point; ajaxRequest(sender, "getPoint", ["x="+(point.x-this.getX()), "y="+(point.y-this.getY())]); }); } 2. UnimImage1 -> OnAjaxEvent: procedure TMainmForm.UnimImage1AjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings); begin if EventName = 'getPoint' then begin ShowMessage(Params.Values['x'] + ',' + Params.Values['y']); end; end; Link to comment Share on other sites More sharing options...
andyhill Posted January 5, 2019 Author Share Posted January 5, 2019 Yes, Thank You Link to comment Share on other sites More sharing options...
Recommended Posts