Commit bbdc42b0 authored by techird's avatar techird

text render bug fixed

parent 3a6e745e
......@@ -7,7 +7,7 @@ var TextRenderer = KityMinder.TextRenderer = kity.createClass('TextRenderer', {
return new kity.Text()
.setId(KityMinder.uuid('node_text'))
.setVerticalAlign('middle')
.setAttr('text-rendering', 'default');
.setAttr('text-rendering', 'inherit');
},
update: function(text, node) {
......
......@@ -5,6 +5,11 @@ KityMinder.registerModule('Zoom', function() {
me.setDefaultOptions('zoom', [10, 20, 30, 50, 80, 100, 120, 150, 200]);
function setTextRendering() {
var value = me._zoomValue >= 100 ? 'optimize-speed' : 'geometricPrecision';
me.getRenderContainer().setAttr('text-rendering', value);
}
function fixPaperCTM(paper) {
var node = paper.shapeNode;
var ctm = node.getCTM();
......@@ -23,6 +28,9 @@ KityMinder.registerModule('Zoom', function() {
};
paper.setViewPort(viewport);
if (value == 100) fixPaperCTM(paper);
},
getZoomValue: function() {
return this._zoomValue;
}
});
......@@ -43,14 +51,8 @@ KityMinder.registerModule('Zoom', function() {
if (timeline) {
timeline.pause();
}
function setTextRendering(value) {
minder.getRoot().traverse(function(node) {
node.getTextShape().setAttr('text-rendering', value);
});
}
setTextRendering(value >= 100 ? 'optimize-speed' : 'geometricPrecision');
timeline = animator.start(minder, 300, 'easeInOutSine', function() {
});
setTextRendering();
timeline = animator.start(minder, 300, 'easeInOutSine', function() {});
}
var ZoomCommand = kity.createClass('Zoom', {
......@@ -102,6 +104,7 @@ KityMinder.registerModule('Zoom', function() {
return {
init: function() {
this._zoomValue = 100;
setTextRendering();
},
commands: {
'zoom-in': ZoomInCommand,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment