excluded text from being jumped over, because it is not on the paper
This commit is contained in:
parent
aad5efff2d
commit
fffc0c4ecb
1 changed files with 39 additions and 4 deletions
|
|
@ -30,8 +30,12 @@ Snap.plugin(function (Snap, Element, Paper, global) {
|
|||
*/
|
||||
Element.prototype.bake = function (toCubics, dec) {
|
||||
var elem = this;
|
||||
if (!elem || !elem.paper) // don't handle unplaced elements. this causes double handling.
|
||||
|
||||
console.log("ElemType: "+elem.type+" "+elem.id+" Children: "+elem.children().length);
|
||||
if (!elem || !elem.paper || elem.type !== "text" || elem.type !== "#text" || elem.type !== "tspan"){
|
||||
console.log("Skip not on paper!");
|
||||
return;
|
||||
} // don't handle unplaced elements. this causes double handling.
|
||||
|
||||
if (typeof (toCubics) === 'undefined')
|
||||
toCubics = false;
|
||||
|
|
@ -42,9 +46,10 @@ Snap.plugin(function (Snap, Element, Paper, global) {
|
|||
if (children.length > 0) {
|
||||
for (var i = 0; i < children.length; i++) {
|
||||
var child = children[i];
|
||||
console.log("ChildType "+i+": "+child.type+" "+child.id+" Children: "+child.children().length);
|
||||
child.bake(toCubics, dec);
|
||||
}
|
||||
if(child.type !== "#text") elem.attr({transform: ''});
|
||||
/*if(child.type !== "#text") */elem.attr({transform: ''});
|
||||
return;
|
||||
}
|
||||
if (elem.type !== "circle" &&
|
||||
|
|
@ -54,14 +59,44 @@ Snap.plugin(function (Snap, Element, Paper, global) {
|
|||
elem.type !== "polygon" &&
|
||||
elem.type !== "polyline" &&
|
||||
elem.type !== "image" &&
|
||||
elem.type !== "path"){
|
||||
elem.type !== "path" &&
|
||||
elem.type !== "text" &&
|
||||
elem.type !== "tspan" &&
|
||||
elem.type !== "#text"){
|
||||
|
||||
// if(elem.type !== 'g' && elem.type !== 'desc' && elem.type !== 'defs')
|
||||
// console.log('skipping unsupported element ', elem.type);
|
||||
return;
|
||||
}
|
||||
|
||||
if (elem.type == 'image'){
|
||||
// if (elem.type == "text" || elem.type == "#text"){
|
||||
// var x = parseFloat(elem.attr('x')),
|
||||
// y = parseFloat(elem.attr('y')),
|
||||
// w = parseFloat(elem.attr('width')),
|
||||
// h = parseFloat(elem.attr('height'));
|
||||
//
|
||||
// // Validity checks from http://www.w3.org/TR/SVG/shapes.html#RectElement:
|
||||
// // If 'x' and 'y' are not specified, then set both to 0. // CorelDraw is creating that sometimes
|
||||
// if (!isFinite(x)) {
|
||||
// console.log('No attribute "x" in image tag. Assuming 0.')
|
||||
// x = 0;
|
||||
// }
|
||||
// if (!isFinite(y)) {
|
||||
// console.log('No attribute "y" in image tag. Assuming 0.')
|
||||
// y = 0;
|
||||
// }
|
||||
// var transform = elem.transform();
|
||||
// var matrix = transform['totalMatrix'];
|
||||
// var transformedX = matrix.x(x, y);
|
||||
// var transformedY = matrix.y(x, y);
|
||||
// var transformedW = matrix.x(x+w, y+h) - transformedX;
|
||||
// var transformedH = matrix.y(x+w, y+h) - transformedY;
|
||||
//
|
||||
// elem.attr({x: transformedX, y: transformedY, width: transformedW, height: transformedH});
|
||||
// return;
|
||||
// }
|
||||
|
||||
if (elem.type == 'image' || elem.type == "text" || elem.type == "#text"){
|
||||
// TODO ...
|
||||
var x = parseFloat(elem.attr('x')),
|
||||
y = parseFloat(elem.attr('y')),
|
||||
|
|
|
|||
Loading…
Reference in a new issue