Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pulsar-next] discontinuation of px rounding #1186

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/image-view/lib/image-editor-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,9 @@ class ImageEditorView {
}

const factor = this.steps[percentageStep]
const newWidth = Math.round(this.originalWidth * factor)
const newHeight = Math.round(this.originalHeight * factor)
const percent = Math.max(1, Math.round((newWidth / this.originalWidth) * 100))
const newWidth = (this.originalWidth * factor)
const newHeight = (this.originalHeight * factor)
const percent = Math.max(1, ((newWidth / this.originalWidth) * 100))

// Switch to pixelated rendering when image is bigger than 200%
if (newWidth > (this.originalWidth * 2)) {
Expand Down
2 changes: 1 addition & 1 deletion packages/wrap-guide/lib/wrap-guide-element.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ module.exports = class WrapGuideElement {
columnWidth -= this.editorElement.getScrollLeft();
const guide = document.createElement('div');
guide.classList.add('wrap-guide');
guide.style.left = `${Math.round(columnWidth)}px`;
guide.style.left = `${(columnWidth)}px`;
return this.element.appendChild(guide);
}
};
18 changes: 9 additions & 9 deletions src/text-editor-component.js
Original file line number Diff line number Diff line change
Expand Up @@ -1578,8 +1578,8 @@ module.exports = class TextEditorComponent {
}
}

decoration.pixelTop = Math.round(wrapperTop);
decoration.pixelLeft = Math.round(wrapperLeft);
decoration.pixelTop = (wrapperTop);
decoration.pixelLeft = (wrapperLeft);
}

updateOverlaysToRender() {
Expand Down Expand Up @@ -2684,7 +2684,7 @@ module.exports = class TextEditorComponent {

positions.set(
nextColumnToMeasure,
Math.round(clientPixelPosition - lineNodeClientLeft)
(clientPixelPosition - lineNodeClientLeft)
);
continue columnLoop; // eslint-disable-line no-labels
} else {
Expand All @@ -2708,7 +2708,7 @@ module.exports = class TextEditorComponent {

positions.set(
nextColumnToMeasure,
Math.round(lastTextNodeRight - lineNodeClientLeft)
(lastTextNodeRight - lineNodeClientLeft)
);
}
}
Expand Down Expand Up @@ -3100,7 +3100,7 @@ module.exports = class TextEditorComponent {
}

getContentWidth() {
return Math.ceil(this.getLongestLineWidth() + this.getBaseCharacterWidth());
return (this.getLongestLineWidth() + this.getBaseCharacterWidth());
}

getScrollContainerClientWidthInBaseCharacters() {
Expand Down Expand Up @@ -3241,7 +3241,7 @@ module.exports = class TextEditorComponent {
}

getMaxScrollTop() {
return Math.round(
return (
Math.max(
0,
this.getScrollHeight() - this.getScrollContainerClientHeight()
Expand Down Expand Up @@ -3280,7 +3280,7 @@ module.exports = class TextEditorComponent {
}

getMaxScrollLeft() {
return Math.round(
return (
Math.max(0, this.getScrollWidth() - this.getScrollContainerClientWidth())
);
}
Expand Down Expand Up @@ -5227,15 +5227,15 @@ class NodePool {
function roundToPhysicalPixelBoundary(virtualPixelPosition) {
const virtualPixelsPerPhysicalPixel = 1 / window.devicePixelRatio;
return (
Math.round(virtualPixelPosition / virtualPixelsPerPhysicalPixel) *
(virtualPixelPosition / virtualPixelsPerPhysicalPixel) *
virtualPixelsPerPhysicalPixel
);
}

function ceilToPhysicalPixelBoundary(virtualPixelPosition) {
const virtualPixelsPerPhysicalPixel = 1 / window.devicePixelRatio;
return (
Math.ceil(virtualPixelPosition / virtualPixelsPerPhysicalPixel) *
(virtualPixelPosition / virtualPixelsPerPhysicalPixel) *
virtualPixelsPerPhysicalPixel
);
}
Loading