function getClickScale(event, target, isShowInfo) {
var imageWidth = target.width;
var imageHeight = target.height;
var eventX = event.xy[0];
var eventY = event.xy[1];
var scalex = eventX / imageWidth;
var scaley = eventY / imageHeight;
var info = '';
info += 'image (' + imageWidth + ', ' + imageHeight + '), ';
info += 'click (' + eventX + ', ' + eventY + '), ';
info += 'scale (' + scalex + ', ' + scaley + ')';
if (typeof (isShowInfo) != 'undefined' && isShowInfo) {
alert(info);
}
return {
scalex : scalex,
scaley : scaley
};
}
Ext.get('main-navigator-image').on(
'mousemove',
function(event, target, obj) {
var scale = getClickScale(event, target);
target.style.cursor = '';
for ( var i = 0; i < areas.length; i++) {
var area = areas[i];
if (isInRect(scale.scalex, scale.scaley,
area.p1.scalex, area.p1.scaley,
area.p2.scalex, area.p2.scaley)) {
target.style.cursor = 'pointer';
break;
}
}
});
});