mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-21 20:56:09 +03:00
Merge pull request #1676 from dmcalpin/master
allow reference strip to work in a web component
This commit is contained in:
commit
704ac9bae4
@ -236,7 +236,7 @@ $.extend( $.ReferenceStrip.prototype, $.EventSource.prototype, $.Viewer.prototyp
|
||||
* @function
|
||||
*/
|
||||
setFocus: function ( page ) {
|
||||
var element = $.getElement( this.element.id + '-' + page ),
|
||||
var element = this.element.querySelector('#' + this.element.id + '-' + page ),
|
||||
viewerSize = $.getElementSize( this.viewer.canvas ),
|
||||
scrollWidth = Number( this.element.style.width.replace( 'px', '' ) ),
|
||||
scrollHeight = Number( this.element.style.height.replace( 'px', '' ) ),
|
||||
|
@ -44,4 +44,34 @@
|
||||
done();
|
||||
});
|
||||
|
||||
// ----------
|
||||
QUnit.test('shadow dom', function(assert) {
|
||||
if (document.head && document.head.attachShadow) {
|
||||
var done = assert.async();
|
||||
|
||||
var shadowDiv = document.createElement('div');
|
||||
shadowDiv.attachShadow({
|
||||
mode: 'open'
|
||||
});
|
||||
shadowDiv.shadowRoot.innerHTML = `<div id="shadow-example"></div>`
|
||||
|
||||
createViewer({
|
||||
element: shadowDiv.shadowRoot.querySelector('#shadow-example'),
|
||||
sequenceMode: true,
|
||||
showReferenceStrip: true,
|
||||
tileSources: [
|
||||
'/test/data/tall.dzi',
|
||||
'/test/data/wide.dzi'
|
||||
]
|
||||
});
|
||||
|
||||
$(shadowDiv).appendTo("#qunit-fixture");
|
||||
|
||||
assert.ok(viewer.referenceStrip, 'referenceStrip exists');
|
||||
done();
|
||||
} else {
|
||||
assert.expect(0);
|
||||
}
|
||||
})
|
||||
|
||||
})();
|
||||
|
Loading…
Reference in New Issue
Block a user