src/pyams_skin/resources/js/ext/flot/jquery.flot.crosshair.min.js
changeset 557 bca7a7e058a3
equal deleted inserted replaced
-1:000000000000 557:bca7a7e058a3
       
     1 !function(e){jQuery.plot.plugins.push({init:function(e){function t(t){i.locked||-1!==i.x&&(i.x=-1,e.triggerRedrawOverlay())}function o(t){var o=e.offset();if(i.locked){var r=Math.max(0,Math.min(t.pageX-o.left,e.width())),h=Math.max(0,Math.min(t.pageY-o.top,e.height()));r>i.x-4&&r<i.x+4&&h>i.y-4&&h<i.y+4?i.highlighted||(i.highlighted=!0,e.triggerRedrawOverlay()):i.highlighted&&(i.highlighted=!1,e.triggerRedrawOverlay())}else e.getSelection&&e.getSelection()?i.x=-1:(i.x=Math.max(0,Math.min(t.pageX-o.left,e.width())),i.y=Math.max(0,Math.min(t.pageY-o.top,e.height())),e.triggerRedrawOverlay())}var i={x:-1,y:-1,locked:!1,highlighted:!1};e.setCrosshair=function(t){if(t){var o=e.p2c(t);i.x=Math.max(0,Math.min(o.left,e.width())),i.y=Math.max(0,Math.min(o.top,e.height()))}else i.x=-1;e.triggerRedrawOverlay()},e.clearCrosshair=e.setCrosshair,e.lockCrosshair=function(t){t&&e.setCrosshair(t),i.locked=!0},e.unlockCrosshair=function(){i.locked=!1,i.rect=null},e.hooks.bindEvents.push(function(e,i){e.getOptions().crosshair.mode&&(i.mouseout(t),i.mousemove(o))}),e.hooks.drawOverlay.push(function(e,t){var o=e.getOptions().crosshair;if(o.mode){var r=e.getPlotOffset();if(t.save(),t.translate(r.left,r.top),-1!==i.x){var h=e.getOptions().crosshair.lineWidth%2?.5:0;if(t.strokeStyle=o.color,t.lineWidth=o.lineWidth,t.lineJoin="round",t.beginPath(),-1!==o.mode.indexOf("x")){var a=Math.floor(i.x)+h;t.moveTo(a,0),t.lineTo(a,e.height())}if(-1!==o.mode.indexOf("y")){var l=Math.floor(i.y)+h;t.moveTo(0,l),t.lineTo(e.width(),l)}i.locked&&(i.highlighted?t.fillStyle="orange":t.fillStyle=o.color,t.fillRect(Math.floor(i.x)+h-4,Math.floor(i.y)+h-4,8,8)),t.stroke()}t.restore()}}),e.hooks.shutdown.push(function(e,i){i.unbind("mouseout",t),i.unbind("mousemove",o)})},options:{crosshair:{mode:null,color:"rgba(170, 0, 0, 0.80)",lineWidth:1}},name:"crosshair",version:"1.0"})}();