How to: Basesheet hover

Apr 15, 2014 at 4:48 PM
Hi!

My question is about hover event for basesheets (like in crossyards).

I want to change the image for that basesheet when hover the mouse... how can I do that?

And the other question is... how can I change the basesheet image easily?

thanks!
Coordinator
Apr 15, 2014 at 6:52 PM
For setting image of basesheet, read this discussion: https://sheetengine.codeplex.com/discussions/430723

Hovering basesheet: in Crossyards it works different, because no canvas is involved there. It is just image tiles generated on the server and a simple transparent image with a quadrilateral drawing is hovered over the top. With sheetengine you could play with the "selecting locations and objects" demo to see how mouse coordinates are transformed to screen coordinates, and there is also a helper function in sheetengine:
sheetengine.calc.checkInboundsPolygon(corners, u, v)
where you need to supply an array of points with u-v coordinates and a 'u' and a 'v' value to check if the point defined by these u-v values fall into the quadrilateral defined by the corners, or not. Return value is an object, whose "inbounds" boolean property holds the result of this check.
To supply data of a basesheet you can use the cornersuv property of a basesheet:
sheetengine.basesheets[0].data.cornersuv
So something like the following:
var mouseu = .. // use selecting objects demo to find this value
var mousev = ..
for (var i=0;i<sheetengine.basesheets.length;i++) {
  var bs = sheetengine.basesheets[i];
  if (sheetengine.calc.checkInboundsPolygon(bs.data.cornersuv, mouseu, mousev).inbounds)
    alert('basesheet is hovered');
}
May 16, 2014 at 11:07 PM
I post my solution here https://sheetengine.codeplex.com/discussions/473442. It shows white border around basesheet.