I am using the web viewer, thumbnails, and image tool bar in our web imaging application. When the user clicks on the selection rectangle in the toolbar and draws a rectangle in the viewer, how do I get the X,Y coordinates of this rectangle? Also is it possible to have the user double-click and point in the viewer and get the the X,Y coordinates of the image in the location where they double-clicked?
Thanks!
Brian
Getting Coordinates Of Selection In Web Viewer
Moderator: Alex
-
- Posts: 4
- Joined: Mon Nov 30, 2015 8:32 pm
Re: Getting Coordinates Of Selection In Web Viewer
Hello Brian,
We will add necessary functions in version 8.3.1. Version 8.3.1 will be available in 2-3 days.
Best regards, Alexander
Version 8.3 does not have public functions for transforming coordinates from screen to viewer and viewer to image coordinate spaces.When the user clicks on the selection rectangle in the toolbar and draws a rectangle in the viewer, how do I get the X,Y coordinates of this rectangle?
We will add necessary functions in version 8.3.1. Version 8.3.1 will be available in 2-3 days.
You need subscribe to the double click event of image viewer and get the X,Y coordinates from the event params.Also is it possible to have the user double-click and point in the viewer and get the X,Y coordinates of the image in the location where they double-clicked?
Best regards, Alexander
Re: Getting Coordinates Of Selection In Web Viewer
Hello Brian,
Version 8.3.1.1 have new functions:
Here is a code snippet that shows how to subscribe to the moude double click event and show mouse coordinates in image coordinate space:
Best regards, Alexander
Version 8.3.1.1 have new functions:
- WebImageViewerJS.transformPointFromScreenToControl(x, y) - Transforms point from browser (screen) coordinate space to coordinate space of image viewer.
- WebImageViewerJS.transformPointFromControlToScreen(x, y) - Transforms point from coordinate space of image viewer to the browser (screen) coordinate space.
- WebImageViewerJS.transformPointFromControlToImage(x, y) - Transforms point from coordinate space of image viewer to an image coordinate space.
- WebImageViewerJS.transformPointFromImageToControl(x, y) - Transforms point from image coordinate space to coordinate space of image viewer.
Here is a code snippet that shows how to subscribe to the moude double click event and show mouse coordinates in image coordinate space:
Code: Select all
$(document).on("dblclick", function (event) {
var x = event.pageX;
var y = event.pageY;
var controlPoint = imageViewer1.transformPointFromScreenToControl(x, y);
var imagePoint = imageViewer1.transformPointFromControlToImage(controlPoint.x, controlPoint.y);
var controlPoint2 = imageViewer1.transformPointFromImageToControl(imagePoint.x, imagePoint.y);
var screenPoint = imageViewer1.transformPointFromControlToScreen(controlPoint2.x, controlPoint2.y);
console.log("s: ", x, y, "-> c: ", controlPoint, "-> i: ", imagePoint);
console.log("i: ", imagePoint, "-> c: ", controlPoint2, "-> s: ", screenPoint);
});
-
- Posts: 4
- Joined: Mon Nov 30, 2015 8:32 pm
Re: Getting Coordinates Of Selection In Web Viewer
It took me awhile, but I finally got a chance to try that and it works great!!!! The image point is exactly what I need and will help us a LOT!
One quick question, though. When I double-click, it highlights part of the web page as if I'm trying to select a large portion of the page for a copy/paste function. How would I disable that without disabling the double-click functionality?
Thank you!!!
Nrianm
One quick question, though. When I double-click, it highlights part of the web page as if I'm trying to select a large portion of the page for a copy/paste function. How would I disable that without disabling the double-click functionality?
Thank you!!!
Nrianm
Re: Getting Coordinates Of Selection In Web Viewer
Hello,
We need more info about your problem:One quick question, though. When I double-click, it highlights part of the web page as if I'm trying to select a large portion of the page for a copy/paste function. How would I disable that without disabling the double-click functionality?
- What browser do you use?
- How to reproduce the problem? Please send me a step-by-step instruction.
-
- Posts: 4
- Joined: Mon Nov 30, 2015 8:32 pm
Re: Getting Coordinates Of Selection In Web Viewer
I've tested and it is only happening in Chrome and not in IE. When I double-click the image in the viewer, it highlights a large portion of the web page as if I held the mouse down and * it across the page trying to select a bunch of text so I can copy it.
Re: Getting Coordinates Of Selection In Web Viewer
I tried to reproduce the problem in our demos in Chrome and was not able to do this. Could you give me a step-by-step guide, which allows to reproduce the problem in our demos? Here are links to our on-line demos:
Best regards, Alexander
-
- Posts: 4
- Joined: Mon Nov 30, 2015 8:32 pm
Re: Getting Coordinates Of Selection In Web Viewer
I couldn't get it to happen in your demos so I figured it was just something weird with my site. I did some research and found the answer. I added these tags to the style of my division to prevent user selection:
-webkit-user-select: none; /* Chrome/Safari */
-moz-user-select: none; /* Firefox */
-ms-user-select: none; /* IE10+ */
/* Rules below not implemented in browsers yet */
-o-user-select: none;
user-select: none;
And that took care of the issue.
Thanks!
-webkit-user-select: none; /* Chrome/Safari */
-moz-user-select: none; /* Firefox */
-ms-user-select: none; /* IE10+ */
/* Rules below not implemented in browsers yet */
-o-user-select: none;
user-select: none;
And that took care of the issue.
Thanks!