Skip to content

Commit

Permalink
fix: DPR in canvas
Browse files Browse the repository at this point in the history
  • Loading branch information
Amr Wagdy committed Mar 16, 2022
1 parent 556a654 commit 341aed9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/ci360.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -769,8 +769,8 @@ import {
}

const ctx = this.canvas.getContext("2d");

ctx.scale(this.devicePixelRatio, this.devicePixelRatio);

this.updateContainerAndCanvasSize(image);

if (this.fullscreenView) {
Expand Down Expand Up @@ -835,6 +835,7 @@ import {
if (!this.hide360Logo && !this.lazyload) this.add360ViewIcon();

const ctx = this.canvas.getContext("2d");
ctx.scale(this.devicePixelRatio, this.devicePixelRatio);
this.updateContainerAndCanvasSize(image);

if (this.fullscreenView) {
Expand Down
2 changes: 1 addition & 1 deletion src/ci360.utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const get360ViewProps = (image) => ({
stopAtEdges: isTrue(image, 'stop-at-edges'),
hide360Logo: isTrue(image, 'hide-360-logo'),
logoSrc: attr(image, 'logo-src') || 'https://scaleflex.ultrafast.io/https://scaleflex.airstore.io/filerobot/js-cloudimage-360-view/360_view.svg',
ratio: attr(image, 'ratio') || attr(image, 'data-ratio') || null,
ratio: attr(image, 'ratio') || attr(image, 'data-ratio'),
imageInfo: attr(image, 'info')|| attr(image, 'data-info') || isTrue(image, 'info')
});

Expand Down
2 changes: 1 addition & 1 deletion src/utils/responsive/get-image-aspect-ratio.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const getImageAspectRatio = (image, providedRatio) => {
imageAspectRatio = providedRatio;
}

if (typeof providedRatio === 'object') {
if (providedRatio && typeof providedRatio === 'object') {
const mediaQueries = Object.keys(providedRatio)
.sort((a, b) => a - b);

Expand Down

0 comments on commit 341aed9

Please sign in to comment.