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

ghost line remain after move crop box #875

Closed
kimuhjin opened this issue Sep 6, 2021 · 7 comments
Closed

ghost line remain after move crop box #875

kimuhjin opened this issue Sep 6, 2021 · 7 comments

Comments

@kimuhjin
Copy link

kimuhjin commented Sep 6, 2021

when i try to zoom in/out or move cropbox, canvas draw solid line right side of image.
when i move img to ghost line, it's disappeared.
this issue is not always happened.

当我zoom in/out或移动cropbox, 图片的右边有一条黑线。如果把图片移到黑线,黑线就没了。
我想reset canvas after move cropbox,但找不到 canvas element.

@kimuhjin
Copy link
Author

kimuhjin commented Sep 6, 2021

i solved this problem with relative issue's comment

//css
.CropperRefresh {
    background-color: white !important;
}

//js
const handleClearCanvas = (canvas) => {
        let canvasEl = canvas.path[1];
        if (canvasEl) {
            canvasEl?.classList?.add('CropperRefresh');
            setTimeout(() => {
                canvasEl?.classList?.remove('CropperRefresh');
            }, 100);
        }
    };

<Cropper
cropmove={handleClearCanvas}
zoom={handleClearCanvas}
...
/>

but i still remain some question
can i force to refresh canvas with add or remove class to canvas?

@fengyuanchen
Copy link
Owner

What's your browser? Version? Any demo?

@matthewfedak
Copy link

matthewfedak commented Sep 27, 2021

I also have this problem. Windows 10 with Chrome Version 93.

ghost-lines-windows-chrome-93

Will try the fix above and post feedback shortly

@fengyuanchen
Copy link
Owner

You can try to add style="will-change: transform;" to the container of the Cropper.

@shadow-Fiend
Copy link

shadow-Fiend commented Oct 14, 2021

I encountered similar problems during initial loading and tailoring.
I suspect that there is a rounding error caused by scaling the image inside the Cropper component.
I've trimmed width minus 1px to remove the extra black lines by dragging the clipping end method in cropend and calling the setData method.

cropper.setData({
    width: state.imgWidth - 1,
});

@fengyuanchen
Copy link
Owner

@shadow-Fiend see #551

@fengyuanchen
Copy link
Owner

This issue has been fixed as of v1.5.13.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants