Skip to content

Commit

Permalink
more font fixing with new sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
raphywink committed Oct 1, 2020
1 parent da73f6b commit f872cdc
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 34 deletions.
3 changes: 3 additions & 0 deletions src/NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

### new features / performance tweaks / improvements

- hierarchy guesser completed for when no DBconfig is available
- higher y resolution on level canvases
- swiched to arial font

### bug fixes

Expand Down
53 changes: 21 additions & 32 deletions src/app/components/hierarchy-path-canvas.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ let HierarchyPathCanvasComponent = {
class="emuwebapp-level-canvas"
id="levelCanvas"
width="4096"
height="256"
height="1024"
ng-style="$ctrl.backgroundCanvas"
></canvas>
Expand All @@ -26,7 +26,7 @@ let HierarchyPathCanvasComponent = {
style="background-color: rgba(200, 200, 200, 0.7); filter: blur(2px);"
id="levelMarkupCanvas"
width="4096"
height="256"
height="1024"
level-name="$ctrl.level.name"
level-type="$ctrl.level.type"></canvas>
</div>
Expand Down Expand Up @@ -237,7 +237,7 @@ class="emuwebapp-selectAttrDef"
let hierarchyWorker = await new HierarchyWorker();
let reducedAnnotation = await hierarchyWorker.reduceAnnotationToViewableTimeAndPath(this.annotation, this.path, this.viewPortSampleStart, this.viewPortSampleEnd);

let nrOfPxlsPerLevel = 256 / this.path.length;
let nrOfPxlsPerLevel = 1024 / this.path.length;

let topLimitPxl = 0;
let bottomLimitPxl = nrOfPxlsPerLevel;
Expand All @@ -258,7 +258,7 @@ class="emuwebapp-selectAttrDef"


// TODO: move to draw helper service or new service and use from here and level.component
private drawLevelDetails = async function (canvas, levelDetails, topLimitPxl: number = 0, bottomLimitPxl: number = 256) {
private drawLevelDetails = async function (canvas, levelDetails, topLimitPxl: number = 0, bottomLimitPxl: number = 1024) {

var labelFontFamily; // font family used for labels only
var fontFamily = styles.fontSmallFamily; // font family used for everything else
Expand Down Expand Up @@ -313,29 +313,18 @@ class="emuwebapp-selectAttrDef"
var scaleY = ctx.canvas.height / ctx.canvas.offsetHeight;

if (levelDetails.name === curAttrDef) {
if (isOpen) {
this.FontScaleService.drawUndistortedTextTwoLines(
ctx,
levelDetails.name,
'(' + levelDetails.type + ')',
fontSize,
fontFamily,
4,
(topLimitPxl + (bottomLimitPxl - topLimitPxl) / 2) - fontSize * scaleY,
styles.colorWhite,
true);
} else {
fontSize -= 2;
this.FontScaleService.drawUndistortedText(
ctx,
levelDetails.name,
fontSize,
fontFamily,
4,
topLimitPxl + (bottomLimitPxl - topLimitPxl) / 2 - (fontSize * scaleY / 2),
styles.colorWhite,
true);
}

fontSize -= 2;
this.FontScaleService.drawUndistortedText(
ctx,
levelDetails.name,
fontSize,
fontFamily,
4,
topLimitPxl + (bottomLimitPxl - topLimitPxl) / 2,
styles.colorWhite,
true);

} else {
this.FontScaleService.drawUndistortedTextTwoLines(
ctx,
Expand All @@ -344,7 +333,7 @@ class="emuwebapp-selectAttrDef"
fontSize,
fontFamily,
4,
topLimitPxl + (bottomLimitPxl - topLimitPxl) / 2 - fontSize * scaleY,
topLimitPxl + (bottomLimitPxl - topLimitPxl) / 2,
styles.colorWhite,
true);
}
Expand Down Expand Up @@ -436,10 +425,10 @@ class="emuwebapp-selectAttrDef"
this.FontScaleService.drawUndistortedText(
ctx,
item.sampleStart,
fontSize - 2,
fontSize - 4,
fontFamily,
posS + 3,
topLimitPxl,
topLimitPxl + (fontSize * scaleY) / 2,
styles.colorBlue,
true);
}
Expand All @@ -451,10 +440,10 @@ class="emuwebapp-selectAttrDef"
this.FontScaleService.drawUndistortedText(
ctx,
durtext,
fontSize - 2,
fontSize - 4,
fontFamily,
posE - (zeroTxtImgWidth * (durtext.length - 3)),
topLimitPxl + (bottomLimitPxl - topLimitPxl) / 4 * 3,
topLimitPxl + (bottomLimitPxl - topLimitPxl) / 4 * 3 + (fontSize * scaleY) / 2,
styles.colorBlue,
true);
}
Expand Down
4 changes: 2 additions & 2 deletions src/app/components/level.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ class="emuwebapp-selectAttrDef"
fontSize - 2,
fontFamily,
posS + 3,
(fontSize * scaleY)/2,
(fontSize * scaleY) / 2,
styles.colorBlue,
true);
}
Expand All @@ -507,7 +507,7 @@ class="emuwebapp-selectAttrDef"
fontSize - 2,
fontFamily,
posE - (ctx.measureText(durtext).width * this.FontScaleService.scaleX),
ctx.canvas.height / 4 * 3 + (fontSize * scaleY)/2,
ctx.canvas.height / 4 * 3 + (fontSize * scaleY) / 2,
styles.colorBlue,
true);
}
Expand Down

0 comments on commit f872cdc

Please sign in to comment.