Fixed sub-bug in Issue 717: Bounding box not surrounding entire image library image, started on Issue 782: Text editing is buggy (IE9)
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1996 eee81c28-f429-11dd-99c0-75d572ba1dddmaster
parent
90fffe8a09
commit
6d6c6aa61f
|
@ -34,6 +34,7 @@ var svg = document.createElementNS(svgns, 'svg');
|
|||
var isOpera_ = !!window.opera;
|
||||
var isWebkit_ = userAgent.indexOf("AppleWebKit") >= 0;
|
||||
var isGecko_ = userAgent.indexOf('Gecko/') >= 0;
|
||||
var isIE_ = userAgent.indexOf('MSIE') >= 0;
|
||||
|
||||
var supportsSelectors_ = (function() {
|
||||
return !!svg.querySelector;
|
||||
|
@ -151,6 +152,7 @@ var supportsNativeSVGTransformLists_ = (function() {
|
|||
svgedit.browser.isOpera = function() { return isOpera_; }
|
||||
svgedit.browser.isWebkit = function() { return isWebkit_; }
|
||||
svgedit.browser.isGecko = function() { return isGecko_; }
|
||||
svgedit.browser.isIE = function() { return isIE_; }
|
||||
|
||||
svgedit.browser.supportsSelectors = function() { return supportsSelectors_; }
|
||||
svgedit.browser.supportsXpath = function() { return supportsXpath_; }
|
||||
|
|
|
@ -2367,8 +2367,9 @@ var getMouseTarget = this.getMouseTarget = function(evt) {
|
|||
var pt = transformPoint( evt.pageX, evt.pageY, root_sctm ),
|
||||
mouse_x = pt.x * current_zoom,
|
||||
mouse_y = pt.y * current_zoom;
|
||||
|
||||
if($.browser.msie) {
|
||||
|
||||
// TODO: Use feature detection
|
||||
if(svgedit.browser.isIE()) {
|
||||
var off = $(container.parentNode).offset();
|
||||
off_x = svgcontent.getAttribute('x')-0 + off.left - container.parentNode.scrollLeft;
|
||||
off_y = svgcontent.getAttribute('y')-0 + off.top - container.parentNode.scrollTop;
|
||||
|
@ -2717,7 +2718,7 @@ var getMouseTarget = this.getMouseTarget = function(evt) {
|
|||
shape = getElem(getId());
|
||||
// IE9 gives the wrong root_sctm
|
||||
// TODO: Use non-browser sniffing way to make this work
|
||||
if($.browser.msie) {
|
||||
if(svgedit.browser.isIE()) {
|
||||
mouse_x = -(off_x - evt.pageX);
|
||||
mouse_y = -(off_y - evt.pageY);
|
||||
}
|
||||
|
@ -3764,7 +3765,15 @@ var textActions = canvas.textActions = function() {
|
|||
// && !svgedit.math.rectsIntersect(transbb, {x: pt.x, y: pt.y, width:0, height:0})) {
|
||||
// textActions.toSelectMode(true);
|
||||
// }
|
||||
|
||||
// For some reason points in IE are off by 1
|
||||
if(svgedit.browser.isIE()) {
|
||||
mouse_x++;
|
||||
mouse_y++;
|
||||
}
|
||||
|
||||
if(last_x === mouse_x && last_y === mouse_y && evt.target !== curtext) {
|
||||
|
||||
textActions.toSelectMode(true);
|
||||
}
|
||||
|
||||
|
@ -3869,6 +3878,12 @@ var textActions = canvas.textActions = function() {
|
|||
for(var i=0; i<len; i++) {
|
||||
var start = curtext.getStartPositionOfChar(i);
|
||||
var end = curtext.getEndPositionOfChar(i);
|
||||
// TODO: Make support property for this
|
||||
if(svgedit.browser.isIE()) {
|
||||
var offset = canvas.contentW * current_zoom;
|
||||
start.x -= offset;
|
||||
end.x -= offset;
|
||||
}
|
||||
|
||||
// Get a "bbox" equivalent for each character. Uses the
|
||||
// bbox data of the actual text for y, height purposes
|
||||
|
|
|
@ -496,12 +496,14 @@ svgedit.utilities.getBBox = function(elem) {
|
|||
|
||||
if(elname === 'use' || elname === 'foreignObject') {
|
||||
if(!ret) ret = selected.getBBox();
|
||||
var bb = {};
|
||||
bb.width = ret.width;
|
||||
bb.height = ret.height;
|
||||
bb.x = ret.x + parseFloat(selected.getAttribute('x')||0);
|
||||
bb.y = ret.y + parseFloat(selected.getAttribute('y')||0);
|
||||
ret = bb;
|
||||
if(!svgedit.browser.isWebkit()) {
|
||||
var bb = {};
|
||||
bb.width = ret.width;
|
||||
bb.height = ret.height;
|
||||
bb.x = ret.x + parseFloat(selected.getAttribute('x')||0);
|
||||
bb.y = ret.y + parseFloat(selected.getAttribute('y')||0);
|
||||
ret = bb;
|
||||
}
|
||||
} else if(~visElems_arr.indexOf(elname)) {
|
||||
try { ret = selected.getBBox();}
|
||||
catch(e) {
|
||||
|
|
Loading…
Reference in New Issue