Fixed bug where certain positioned elements could not be de-selected

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1242 eee81c28-f429-11dd-99c0-75d572ba1ddd
master
Alexis Deveria 2010-01-18 21:18:46 +00:00
parent 0f46184757
commit 72c6cb59e8
2 changed files with 14 additions and 6 deletions

View File

@ -250,13 +250,10 @@ function svg_edit_setup() {
var zoomlevel = z_info.zoom; var zoomlevel = z_info.zoom;
var bb = z_info.bbox; var bb = z_info.bbox;
$('#zoom').val(Math.round(zoomlevel*100)); $('#zoom').val(Math.round(zoomlevel*100));
// setResolution(res.w * zoomlevel, res.h * zoomlevel);
// console.log('zoomlevel',zoomlevel)
if(autoCenter) { if(autoCenter) {
updateCanvas(); updateCanvas();
} else { } else {
console.log(bb.x, bb.x * zoomlevel);
updateCanvas(false, {x: bb.x * zoomlevel + (bb.width * zoomlevel)/2, y: bb.y * zoomlevel + (bb.height * zoomlevel)/2}); updateCanvas(false, {x: bb.x * zoomlevel + (bb.width * zoomlevel)/2, y: bb.y * zoomlevel + (bb.height * zoomlevel)/2});
} }
@ -578,8 +575,6 @@ function svg_edit_setup() {
var zoom = svgCanvas.getZoom(); var zoom = svgCanvas.getZoom();
var w_area = workarea; var w_area = workarea;
// console.log('y',zoom,(w_area[0].scrollTop + w_area.height()/2)/zoom);
zoomChanged(window, { zoomChanged(window, {
width: 0, width: 0,
height: 0, height: 0,

View File

@ -998,6 +998,7 @@ function BatchCommand(text) {
}); });
var i = curBBoxes.length; var i = curBBoxes.length;
while (i--) { while (i--) {
if(!rubberBBox.width || !rubberBBox.width) continue;
if (Utils.rectsIntersect(rubberBBox, curBBoxes[i].bbox)) { if (Utils.rectsIntersect(rubberBBox, curBBoxes[i].bbox)) {
resultList.push(curBBoxes[i].elem); resultList.push(curBBoxes[i].elem);
} }
@ -2383,6 +2384,7 @@ function BatchCommand(text) {
case "select": case "select":
started = true; started = true;
current_resize_mode = "none"; current_resize_mode = "none";
if (mouse_target != svgroot) { if (mouse_target != svgroot) {
// if this element is not yet selected, clear selection and select it // if this element is not yet selected, clear selection and select it
if (selectedElements.indexOf(mouse_target) == -1) { if (selectedElements.indexOf(mouse_target) == -1) {
@ -3228,6 +3230,7 @@ function BatchCommand(text) {
var current_path_oldd = null; var current_path_oldd = null;
var current_ctrl_pt_drag = -1; var current_ctrl_pt_drag = -1;
var link_control_pts = false; var link_control_pts = false;
var selected_pts = [];
var resetPointGrips = function() { var resetPointGrips = function() {
if(!current_path) return; if(!current_path) return;
@ -3297,10 +3300,15 @@ function BatchCommand(text) {
}; };
var addNodeToSelection = function(point) { var addNodeToSelection = function(points) {
// Currently only one node can be selected at a time, should allow more later // Currently only one node can be selected at a time, should allow more later
// Should point be the index or the grip element? // Should point be the index or the grip element?
// if(!$.isArray(points)) points = [points];
//
// $.merge(selected_pts, points);
// $.unique(selected_pts);
var is_closed = pathIsClosed(); var is_closed = pathIsClosed();
var last_pt = current_path_pts.length/2 - 1; var last_pt = current_path_pts.length/2 - 1;
@ -3867,6 +3875,11 @@ function BatchCommand(text) {
current_path_pt_drag = parseInt(id.substr(14)); current_path_pt_drag = parseInt(id.substr(14));
addNodeToSelection(current_path_pt_drag); addNodeToSelection(current_path_pt_drag);
updateSegLine(); updateSegLine();
// if(evt.shiftKey) {
// if(current_path_pt)
// }
} else if(id.indexOf("ctrlpointgrip_") == 0) { } else if(id.indexOf("ctrlpointgrip_") == 0) {
current_ctrl_pt_drag = id.split('_')[1]; current_ctrl_pt_drag = id.split('_')[1];
var node_num = current_ctrl_pt_drag.split('c')[0]-0; var node_num = current_ctrl_pt_drag.split('c')[0]-0;