Fixed connector bug in Webkit, fixed disabling of buttons when no-stroke is set

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1342 eee81c28-f429-11dd-99c0-75d572ba1ddd
This commit is contained in:
Alexis Deveria
2010-02-04 19:06:49 +00:00
parent 2229ecdd45
commit 74bac64ea5
3 changed files with 57 additions and 30 deletions

View File

@@ -162,6 +162,19 @@ $(function() {
// Set point of connected element
var pt2 = getBBintersect(pt.x, pt.y, $(line).data(alt_pre + '_bb'), $(line).data(alt_pre + '_off')?sw:0);
setPoint(line, conn.is_start?'end':0, pt2.x, pt2.y, true);
// Update points attribute manually for webkit
if(navigator.userAgent.indexOf('AppleWebKit') != -1) {
var pts = line.points;
var len = pts.numberOfItems;
var pt_arr = Array(len);
for(var j=0; j< len; j++) {
var pt = pts.getItem(j);
pt_arr[j] = pt.x + ',' + pt.y;
}
line.setAttribute("points",pt_arr.join(" "));
}
}
}
}
@@ -495,7 +508,6 @@ $(function() {
)) {
var start = elem.getAttribute("marker-start");
var end = elem.getAttribute("marker-end");
console.log('elem',elem);
cur_line = elem;
$(elem)
.data("start_off", !!start)
@@ -503,14 +515,15 @@ $(function() {
}
updateConnectors();
},
// toolButtonStateUpdate: function(opts) {
// if(opts.nostroke) {
// if ($('#mode_connect').hasClass('tool_button_current')) {
// clickSelect();
// }
// }
// $('#mode_connect').toggleClass('tool_button',opts.nostroke).toggleClass('tool_button_disabled',opts.nostroke);
// }
toolButtonStateUpdate: function(opts) {
if(opts.nostroke) {
if ($('#mode_connect').hasClass('tool_button_current')) {
clickSelect();
}
}
$('#mode_connect')
.toggleClass('disabled',opts.nostroke);
}
};
});
});