Add files via upload
Signed-off-by: prescientmoon <git@moonythm.dev>
This commit is contained in:
parent
0c8f42db52
commit
6289205e5d
|
@ -76,6 +76,7 @@ function and(id){
|
||||||
function addclk(ob){
|
function addclk(ob){
|
||||||
var rep = ob.rep;
|
var rep = ob.rep;
|
||||||
$((ob.img)).mousedown(function(e){
|
$((ob.img)).mousedown(function(e){
|
||||||
|
e.preventDefault();
|
||||||
var svg = document.getElementById("svg1");
|
var svg = document.getElementById("svg1");
|
||||||
$(svg).append(ob.rep);
|
$(svg).append(ob.rep);
|
||||||
$(svg).append($(ob.pin1.rep));
|
$(svg).append($(ob.pin1.rep));
|
||||||
|
|
|
@ -63,14 +63,47 @@ var xbeg = 0;
|
||||||
var ybeg = 0;
|
var ybeg = 0;
|
||||||
var moveing = false;
|
var moveing = false;
|
||||||
|
|
||||||
$("#svg1").mousedown(function(e){
|
$("svg").mousemove(function(e){
|
||||||
|
if (moveing && selected == "yay"){
|
||||||
|
if (!(zooming)){
|
||||||
|
zooming = true;
|
||||||
|
|
||||||
|
//setting our first mouse poitions
|
||||||
|
xbeg = e.pageX * zoomx/window.innerWidth;
|
||||||
|
ybeg = e.pageY * zoomy/window.innerHeight;
|
||||||
|
|
||||||
|
xbeg += xvb;
|
||||||
|
ybeg += yvb;
|
||||||
|
console.log("started zooming"+xbeg+"and"+ybeg);
|
||||||
|
//moveing = (moveing +1)%2;
|
||||||
|
}
|
||||||
|
|
||||||
|
var newx = e.pageX * zoomx/window.innerWidth;
|
||||||
|
var newy = e.pageY * zoomy/window.innerHeight;
|
||||||
|
|
||||||
|
newx += xvb;
|
||||||
|
newy += yvb;
|
||||||
|
|
||||||
|
xvb -= newx - xbeg;
|
||||||
|
yvb -= newy - ybeg;
|
||||||
|
updatescr();
|
||||||
|
|
||||||
|
console.log(xvb+"newx"+newx+"xbeg"+xbeg);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$("svg").mousedown(function(e){
|
||||||
|
//e.preventDefault();
|
||||||
moveing = true;
|
moveing = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#svg1").mouseup(function(e){
|
|
||||||
|
$("svg").mouseup(function(e){
|
||||||
|
e.preventDefault();
|
||||||
|
selected = "yay";
|
||||||
zooming = false;
|
zooming = false;
|
||||||
moveing = false;
|
moveing = false;
|
||||||
console.log("got a mouse up");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,9 @@ $(modal).mousedown(function(e){
|
||||||
//and 'addel' is the true id of the modal from DOM
|
//and 'addel' is the true id of the modal from DOM
|
||||||
$("#addel").modal("show");
|
$("#addel").modal("show");
|
||||||
|
|
||||||
|
//being sure we wont move the components
|
||||||
|
moveing = false;
|
||||||
|
|
||||||
//activatng the drag and drop for the blue box
|
//activatng the drag and drop for the blue box
|
||||||
selected = "butt";
|
selected = "butt";
|
||||||
});
|
});
|
||||||
|
@ -66,11 +69,12 @@ function addel(){
|
||||||
//================================preventing deafult actions==========================
|
//================================preventing deafult actions==========================
|
||||||
|
|
||||||
//nothing to say here
|
//nothing to say here
|
||||||
$("img,rect,circle,p").mousedown(function(e){
|
$("img,rect,circle,p,foreignObject").mousedown(function(e){
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
});
|
});
|
||||||
$("*").mouseup(function(e){
|
$("*").mouseup(function(e){
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
moveing = false;
|
||||||
});
|
});
|
||||||
$("img").click(function(e){
|
$("img").click(function(e){
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
@ -102,38 +106,12 @@ let snap = false;
|
||||||
$("body").mousemove(function(e){
|
$("body").mousemove(function(e){
|
||||||
//calling the drag function
|
//calling the drag function
|
||||||
drag(e,selected);
|
drag(e,selected);
|
||||||
|
|
||||||
if (moveing){
|
|
||||||
if (!(zooming)){
|
|
||||||
zooming = true;
|
|
||||||
|
|
||||||
//setting our first mouse poitions
|
|
||||||
xbeg = e.pageX * zoomx/window.innerWidth;
|
|
||||||
ybeg = e.pageY * zoomy/window.innerHeight;
|
|
||||||
|
|
||||||
xbeg += xvb;
|
|
||||||
ybeg += yvb;
|
|
||||||
console.log("started zooming"+xbeg+"and"+ybeg);
|
|
||||||
}
|
|
||||||
|
|
||||||
var newx = e.pageX * zoomx/window.innerWidth;
|
|
||||||
var newy = e.pageY * zoomy/window.innerHeight;
|
|
||||||
|
|
||||||
newx += xvb;
|
|
||||||
newy += yvb;
|
|
||||||
|
|
||||||
xvb -= newx - xbeg;
|
|
||||||
yvb -= newy - ybeg;
|
|
||||||
updatescr();
|
|
||||||
|
|
||||||
console.log(xvb+"newx"+newx+"xbeg"+xbeg);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
$("body").mouseup(function(e){
|
$("body").mouseup(function(e){
|
||||||
selected = "yay";
|
selected = "yay";
|
||||||
|
console.log("got a mouse up");
|
||||||
});
|
});
|
||||||
$("body").mousedown(function(e){
|
$("body").mousedown(function(e){
|
||||||
|
|
||||||
//beeing sure that we actually want to drag something
|
//beeing sure that we actually want to drag something
|
||||||
if (selected!="yay"){
|
if (selected!="yay"){
|
||||||
|
|
||||||
|
|
|
@ -74,6 +74,7 @@ function not(id){
|
||||||
function addclk11(ob){
|
function addclk11(ob){
|
||||||
var rep = ob.rep;
|
var rep = ob.rep;
|
||||||
$((ob.img)).mousedown(function(e){
|
$((ob.img)).mousedown(function(e){
|
||||||
|
e.preventDefault();
|
||||||
var svg = document.getElementById("svg1");
|
var svg = document.getElementById("svg1");
|
||||||
$(svg).append(ob.rep);
|
$(svg).append(ob.rep);
|
||||||
$(svg).append($(ob.pin1.rep));
|
$(svg).append($(ob.pin1.rep));
|
||||||
|
|
Loading…
Reference in a new issue