Croppie icon indicating copy to clipboard operation
Croppie copied to clipboard

WIP: Support for second viewport

Open michael-letcher opened this issue 7 years ago • 6 comments

Requires proper config props set.

Replacing view2, width2 and height2.

Fixes #622

michael-letcher avatar Feb 04 '19 22:02 michael-letcher

image

michael-letcher avatar Feb 04 '19 22:02 michael-letcher

Will also need to export two images as requested in the ticket.

michael-letcher avatar Feb 04 '19 23:02 michael-letcher

Is this functionality still in development or are there already some implementations?

Chapjus avatar May 02 '19 12:05 Chapjus

I had the same problem, but I got a solution!

-> You have to change some files: (Just add the following lines to the files)

croppie.js: if (self.options.viewport.view2) { viewport2 = self.elements.viewport2 = document.createElement('div'); addClass(viewport2, 'cr-viewport-2');

        css(viewport2, {
            // Remove 4px due to border
            width: (self.options.viewport.width2 - 4) + 'px',
            height: self.options.viewport.height2 + 'px'
        });
        viewport2.setAttribute('tabindex', 0);

        viewport.appendChild(viewport2);
    }

croppie.css: .croppie-container .cr-viewport-2 { position: absolute; border: dashed #fff; border-width: 1px 0; margin: auto; top: 0; bottom: 0; right: 0; left: 0; z-index: 0; }

After that, you are ready to set the second viewport:

viewport: { width: 300, height: 200, view2: { width2: 300, height2: 150 }, width2: 300, height2: 150

}

Best regards :D

marcelx180 avatar Oct 14 '19 06:10 marcelx180

@Chapjus I'm no longer working on this. What I added was enough to support what we needed.

It's up to the owners (whom seem to no longer be active in this project) or others whom might want this feature to be completed and get it merged.

Really, all that's needed is to refactor the property names (I was in a rush :) ) and test.

michael-letcher avatar Oct 30 '19 00:10 michael-letcher

@thedustinsmith any chance we can get some feedback on this?

michael-letcher avatar Apr 30 '20 04:04 michael-letcher