Fix SVG export for Item#visible, and import display attributes correctly.

Closes #471.
This commit is contained in:
Jürg Lehni 2014-05-07 16:59:57 +01:00
parent 56389a3929
commit 2412942d04
2 changed files with 11 additions and 6 deletions

View file

@ -323,7 +323,7 @@ new function() {
if (attrs.opacity === 1)
delete attrs.opacity;
if (item._visibility != null && !item._visibility)
if (!item._visible)
attrs.visibility = 'hidden';
return setAttributes(node, attrs);

View file

@ -28,7 +28,7 @@ new function() {
value = null;
// Interpret value as number. Never return NaN, but 0 instead.
// If the value is a sequence of numbers, parseFloat will
// return the first occuring number, which is enough for now.
// return the first occurring number, which is enough for now.
return value == null
? allowNull
? null
@ -243,8 +243,8 @@ new function() {
// Note the namespaced xlink:href attribute is just called href
// as a property on node.
// TODO: Support overflow and width, height, in combination with
// overflow: hidden. Paper.js currently does not suport PlacedSymbol
// clipping, but perhaps it should?
// overflow: hidden. Paper.js currently does not support
// PlacedSymbol clipping, but perhaps it should?
var id = (getValue(node, 'href', true) || '').substring(1),
definition = definitions[id],
point = getPoint(node, 'x', 'y');
@ -306,9 +306,9 @@ new function() {
// Attributes and Styles
// NOTE: Parmeter sequence for all apply*() functions is:
// NOTE: Parameter sequence for all apply*() functions is:
// (item, value, name, node) rather than (item, node, name, value),
// so we can ommit the less likely parameters from right to left.
// so we can omit the less likely parameters from right to left.
function applyTransform(item, value, name, node) {
// http://www.w3.org/TR/SVG/types.html#DataTypeTransformList
@ -411,6 +411,11 @@ new function() {
item.setVisible(value === 'visible');
},
display: function(item, value) {
// NOTE: 'none' gets translated to null in getAttribute()
item.setVisible(value !== null);
},
'stop-color': function(item, value) {
// http://www.w3.org/TR/SVG/pservers.html#StopColorProperty
if (item.setColor)