Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 4da09542 authored by Robin Tissot's avatar Robin Tissot
Browse files

Fixes updating content ratio in visualisation panel.

parent 82dfba35
Branches
No related tags found
No related merge requests found
......@@ -5,6 +5,13 @@ const BasePanel = Vue.extend({
ratio: 1
};
},
watch: {
'part.loaded': function(n, o) {
if (this.part.loaded) {
this.refresh();
}
}
},
methods: {
setRatio() {
this.ratio = this.$el.firstChild.clientWidth / this.part.image.size[0];
......
......@@ -29,7 +29,6 @@ const visuLine = LineBase.extend({
this.textElement.style.fontSize = lineHeight * (1/2) + 'px';
return 10+'px';
},
computeTextLength() {
if (!this.line.currentTrans) return;
content = this.line.currentTrans.content;
......@@ -61,7 +60,6 @@ const visuLine = LineBase.extend({
textPathId() {
return this.line ? 'textPath'+this.line.pk : '';
},
maskStrokeColor() {
if (this.line.currentTrans && this.line.currentTrans.content) {
return 'none';
......@@ -73,7 +71,6 @@ const visuLine = LineBase.extend({
if (this.line == null || !this.line.mask) return '';
return this.line.mask.map(pt => Math.round(pt[0]*this.ratio)+','+Math.round(pt[1]*this.ratio)).join(' ');
},
fakeBaseline() {
// create a fake path based on the mask,
var min = this.line.mask.reduce((minPt, curPt) => (curPt[0] < minPt[0]) ? curPt : minPt);
......
......@@ -30,14 +30,17 @@ const VisuPanel = BasePanel.extend({
this.editLine = this.part.lines[index - 1];
}
},
resetLines() {
if (this.part.lines.length) {
this.$refs.visulines.forEach(function(line) {
line.reset();
});
}
},
updateView() {
this.$el.querySelector('svg').style.height = Math.round(this.part.image.size[1] * this.ratio) + 'px';
Vue.nextTick(function() {
if (this.part.lines.length) {
this.$refs.visulines.forEach(function(line) {
line.reset();
});
}
this.resetLines();
}.bind(this));
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment