javascriptjavagwtgxtopenseadragon

GWT external JavaScript integration (OpenSeadragon) problem with EventHandlers after full screen


in my GWT-Project I currently integrating an external JavaScript package OpenSeadragon (see here), which is a ImageViewer with zoo, rotate and fullscreen function. It mostly works well so far. The only anoying problem is, that nothing is clickable any more after coming back from the fullscreen mode. I think the reason for this greatly unwanted behaviour is, that openseadragon moves all other Dom-Elements away, when it shows fullscreen (see this bug for more details). The code is the following:

    public native void createZoomeImage(String ressource, Element where, SingleImageEditor sie)
/*-{
    var viewer =  $wnd.OpenSeadragon({
        element: where,
        showRotationControl: true,
        prefixUrl: "scripts/openseadragon-bin-2.4.2/images/",
        debugMode: true,
        tileSources: ressource
    });
    viewer.addHandler("full-screen", function (data) {
        if(data.fullScreen == false){
                $wnd.activatepanel(sie);
        }
    });
}-*/;

The Handler was added by me, because firstly I thought, it would be enough to activate the panel again. ($wnd.activatepanel(sie); does refere to a java method, which does exactly this). Yet this did not change a thing. Now, my question: Does anybody know an elegant way to refresh the eventhandlers in GWT or antoher workaround?

Sincerely,

Erik


Solution

  • I got it figured out:

            var viewer =  $wnd.OpenSeadragon({
            element: where,
            showRotationControl: true,
            prefixUrl: "scripts/openseadragon-bin-2.4.2/images/",
            tileSources: ressource,
        });
        viewer.addHandler("pre-full-page", function (data) {
                data.preventDefaultAction=true;
                openFullscreen();
        });
        function openFullscreen() {
            if (where.requestFullscreen) {
                where.requestFullscreen();
            } else if (where.mozRequestFullScreen) { 
                where.mozRequestFullScreen();
            } else if (where.webkitRequestFullscreen) { 
                where.webkitRequestFullscreen();
            } else if (where.msRequestFullscreen) {
                where.msRequestFullscreen();
            }
        }