Our image selection technology has finally achieved a phased breakthrough today!
Is the result of common efforts, this technology can be achieved, in the work area, the picture frame selection, finished can be the starting point, the end point coordinates display, and, the coordinates of the point can be easily manually modified, after the change, press OK, the box will also change corresponding changes. Some of the code is as follows:
1 getting the mouse position
function Movetomouseloc (e) {if (Ns4 | | ns6) {Curpositionx = E.pagexcurpositiony = E.pagey;} else {Curpositionx = Event.x + Document.body.scrollleft;curpositiony = Event.y + document.documentElement.scrollTop;} return true;}
2 Mouse down Events
function OnMouseDown (e) {if(Resizing = =true) return true; Resizing=true; if(divsx<=curpositionx&&curpositionx<=Divex) { if(divsy<=curpositiony&&curpositiony<=Divey) {Startpointx=Curpositionx; Startpointy=Curpositiony; } } if(curpositionx<divsx) {Startpointx=DIVSX; } if(curpositionx>Divex) {Startpointx=Divex; } if(divsy>curpositiony) {Startpointy=Divsy; } if(curpositiony>Divey) {Startpointy=Divey; } drawborder (); }
3 Mouse Bounce Events
function OnMouseUp (e) {if(resizing) {drawborder (); Resizing=false; } if(curpositionx<divsx) {Endpointx=DIVSX; } if(curpositionx>Divex) {Endpointx=Divex; } if(divsy>curpositiony) {Endpointy=Divsy; } if(curpositiony>Divey) {Endpointy=Divey; } if(Startpointx > && Startpointx < 400) $("#startPointX"). Val (Startpointx); if(Startpointy > && startpointy < 600) $("#startPointY"). Val (Startpointy); if(Endpointx > && Endpointx < 400) $("#endPointX"). Val (Endpointx); if(Endpointy > && endpointy < 600) $("#endPointY"). Val (Endpointy); }
4 Draw Wireframe
function Drawborder () {if(divsx<=curpositionx&&curpositionx<=Divex) { if(divsy<=curpositiony&&curpositiony<=Divey) {Endpointx=Curpositionx; Endpointy=Curpositiony; With (Border.style) {width= Math.Abs (Startpointx-endpointx) + "px"; Height= Math.Abs (Startpointy-endpointy) + "px"; Left= Math.min (Startpointx, Endpointx) + "px"; Top= Math.min (Startpointy, Endpointy) + "px"; } } } }
These are some of the technical implementations of the code.
Is the scene that the image chooses realizes.
Image selection techniques to be tasted