Fixed font-size normalization for the text-shape
This commit is contained in:
parent
2a91c6aa0b
commit
3c750575cf
@ -38,6 +38,7 @@ export default class WhiteboardOverlay extends Component {
|
||||
this.checkIfOutOfBounds = this.checkIfOutOfBounds.bind(this);
|
||||
this.svgCoordinateToPercentages = this.svgCoordinateToPercentages.bind(this);
|
||||
this.normalizeThickness = this.normalizeThickness.bind(this);
|
||||
this.normalizeFont = this.normalizeFont.bind(this);
|
||||
}
|
||||
|
||||
|
||||
@ -71,6 +72,10 @@ export default class WhiteboardOverlay extends Component {
|
||||
return (thickness * 100) / this.props.physicalSlideWidth;
|
||||
}
|
||||
|
||||
normalizeFont(fontSize) {
|
||||
return (fontSize * 100) / this.props.physicalSlideHeight;
|
||||
}
|
||||
|
||||
generateNewShapeId() {
|
||||
this.count = this.count + 1;
|
||||
this.currentShapeId = `${this.props.userId}-${this.count}-${new Date().getTime()}`;
|
||||
@ -130,6 +135,7 @@ export default class WhiteboardOverlay extends Component {
|
||||
getCurrentShapeId: this.getCurrentShapeId,
|
||||
generateNewShapeId: this.generateNewShapeId,
|
||||
normalizeThickness: this.normalizeThickness,
|
||||
normalizeFont: this.normalizeFont,
|
||||
sendAnnotation,
|
||||
resetTextShapeSession,
|
||||
setTextShapeActiveId,
|
||||
|
@ -242,7 +242,7 @@ export default class TextDrawListener extends Component {
|
||||
}
|
||||
|
||||
handleDrawText(startPoint, width, height, status, id, text) {
|
||||
const { normalizeThickness, sendAnnotation } = this.props.actions;
|
||||
const { normalizeFont, sendAnnotation } = this.props.actions;
|
||||
|
||||
const annotation = {
|
||||
id,
|
||||
@ -252,7 +252,7 @@ export default class TextDrawListener extends Component {
|
||||
x: startPoint.x, // left corner
|
||||
y: startPoint.y, // left corner
|
||||
fontColor: this.props.drawSettings.color,
|
||||
calcedFontSize: normalizeThickness(this.props.drawSettings.textFontSize), // fontsize
|
||||
calcedFontSize: normalizeFont(this.props.drawSettings.textFontSize), // fontsize
|
||||
textBoxWidth: width, // width
|
||||
text,
|
||||
textBoxHeight: height, // height
|
||||
|
Loading…
Reference in New Issue
Block a user