Skip to content

Commit 5b21abf

Browse files
[BUGFIX] Fix Verovio scaling (#1970)
1 parent 23e0728 commit 5b21abf

1 file changed

Lines changed: 9 additions & 13 deletions

File tree

Resources/Public/JavaScript/PageView/ScoreControl.js

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ dlfScoreUtil.fetchScoreDataFromServer = function (image, scoreUrl, pagebeginning
4646
pageHeight: image.height,
4747
pageWidth: image.width,
4848
adjustPageHeight: true,
49-
adjustPageWidth: true,
50-
scale: image.width > image.height ? 40 : 80
49+
adjustPageWidth: false,
50+
scaleToPageSize: true
5151
});
5252

5353
if (scoreUrl === '') {
@@ -276,13 +276,11 @@ const dlfViewerScoreControl = function (dlfViewer, pagebeginning, pagecount) {
276276
*/
277277
dlfViewerScoreControl.prototype.loadScoreData = function (image, scoreData, tk) {
278278
var target = document.getElementById('tx-dlf-score-' + this.dlfViewer.counter);
279-
// Const target = document.getElementById('tx-dlf-score');
280279

281280
const width = image.width;
282281
const height = image.height;
283282

284283
var extent = [-width, -height, width, height];
285-
// [offsetWidth, -imageSourceObj.height, imageSourceObj.width + offsetWidth, 0]
286284

287285
var proj = new ol.proj.Projection({
288286
code: 'score-projection',
@@ -295,7 +293,6 @@ dlfViewerScoreControl.prototype.loadScoreData = function (image, scoreData, tk)
295293
// View: tx_dlf_viewer.view,
296294
view: new ol.View({
297295
projection: proj,
298-
//Center: [0, 0], center: ol.extent.getCenter(extent),
299296
center: [0, 0],
300297
extent,
301298
zoom: 1,
@@ -363,11 +360,8 @@ dlfViewerScoreControl.prototype.loadScoreData = function (image, scoreData, tk)
363360
} else if (pdfFormat === "B4") {
364361
pdfSize = [2500, 3530];
365362
}
366-
367363
var pdfOrientation = width > height ? 'landscape' : '';
368364
var pdfLandscape = pdfOrientation === 'landscape';
369-
var pdfHeight = pdfLandscape ? pdfSize[0] : pdfSize[1];
370-
var pdfWidth = pdfLandscape ? pdfSize[1] : pdfSize[0];
371365

372366
/**
373367
* Get the font name
@@ -414,13 +408,15 @@ dlfViewerScoreControl.prototype.loadScoreData = function (image, scoreData, tk)
414408
var pdfOptions = {
415409
adjustPageHeight: false,
416410
adjustPageWidth: false,
417-
breaks: "auto",
411+
justifyVertically: true,
412+
landscape: pdfLandscape,
418413
mdivAll: true,
419414
mmOutput: true,
420-
footer: "auto",
421-
pageHeight: pdfHeight,
422-
pageWidth: pdfWidth,
423-
scale: pdfOrientation === 'landscape' ? 80 : 100
415+
pageHeight: pdfSize[1],
416+
pageMarginBottom: pdfLandscape ? 0 : 200,
417+
pageMarginLeft: pdfLandscape ? 240 : 50,
418+
pageWidth: pdfSize[0],
419+
scaleToPageSize: true
424420
};
425421

426422
const pdf_tk = new verovio.toolkit();

0 commit comments

Comments
 (0)