Fixed doctest problems.

This commit is contained in:
Uwe Oestermeier 2019-07-05 14:11:43 +02:00
parent 4009ddd422
commit 8b4c6c2014
4 changed files with 23 additions and 17 deletions

5
dist/iwmlib.js vendored
View File

@ -4985,10 +4985,11 @@
* @param {String} [touchAction=none] - CSS to set touch action style, needed to prevent * @param {String} [touchAction=none] - CSS to set touch action style, needed to prevent
* pointer cancel events. Use null if the * pointer cancel events. Use null if the
* the touch action should not be set. * the touch action should not be set.
* @param {DOM node} debugCanvas - Shows debug infos about touches if not null
*/ */
constructor( constructor(
element, element,
{ stopEvents = 'auto', claimEvents = true, useCapture = true, touchAction = 'none' } = {} { stopEvents = 'auto', claimEvents = true, useCapture = true, touchAction = 'none', debugCanvas = null } = {}
) { ) {
this.onCapture = null; this.onCapture = null;
this.element = element; this.element = element;
@ -5020,7 +5021,7 @@
mouseWheelElement: window mouseWheelElement: window
}); });
if (typeof debugCanvas !== 'undefined') { if (debugCanvas !== null) {
requestAnimationFrame(dt => { requestAnimationFrame(dt => {
this.showTouches(dt, debugCanvas); this.showTouches(dt, debugCanvas);
}); });

8
dist/iwmlib.pixi.js vendored
View File

@ -6053,6 +6053,10 @@
window.Capabilities = Capabilities; window.Capabilities = Capabilities;
window.CapabilitiesTests = CapabilitiesTests; window.CapabilitiesTests = CapabilitiesTests;
/** Basic class for poppable elements that need to be closed as soon as one poppable is
* shown.
*/
/* eslint-disable no-unused-vars */ /* eslint-disable no-unused-vars */
/** /**
* A base class for scatter specific events. * A base class for scatter specific events.
@ -14829,7 +14833,7 @@
* @extends Popup * @extends Popup
* @see {@link https://www.iwm-tuebingen.de/iwmbrowser/lib/pixi/popupmenu.html|DocTest} * @see {@link https://www.iwm-tuebingen.de/iwmbrowser/lib/pixi/popupmenu.html|DocTest}
*/ */
class PopupMenu extends Popup { class PopupMenu$1 extends Popup {
/** /**
* Creates an instance of a PopupMenu. * Creates an instance of a PopupMenu.
@ -15478,7 +15482,7 @@
window.Stylus = Stylus; window.Stylus = Stylus;
window.Switch = Switch; window.Switch = Switch;
window.Popup = Popup; window.Popup = Popup;
window.PopupMenu = PopupMenu; window.PopupMenu = PopupMenu$1;
window.Modal = Modal; window.Modal = Modal;
window.Volatile = Volatile; window.Volatile = Volatile;
window.Message = Message; window.Message = Message;

View File

@ -13,9 +13,8 @@
debugCanvas.width = main.getBoundingClientRect().width debugCanvas.width = main.getBoundingClientRect().width
let context = debugCanvas.getContext('2d') let context = debugCanvas.getContext('2d')
context.clearRect(0, 0, debugCanvas.width, debugCanvas.height) context.clearRect(0, 0, debugCanvas.width, debugCanvas.height)
let stage = scatterContainer.polygon let stage = scatterContainer.polygon
stage.draw(context, { stroke: '#0000FF'}) stage.draw(context, { stroke: "#0000FF"})
for(let scatter of scatterContainer.scatter.values()) { for(let scatter of scatterContainer.scatter.values()) {
let polygon = scatter.polygon let polygon = scatter.polygon
polygon.draw(context, { stroke: '#0000FF'}) polygon.draw(context, { stroke: '#0000FF'})
@ -26,6 +25,7 @@
requestAnimationFrame((dt) => { requestAnimationFrame((dt) => {
drawPolygons() drawPolygons()
animatePolygons() animatePolygons()
}) })
} }
</script> </script>
@ -81,6 +81,8 @@ app.run()
animatePolygons() animatePolygons()
</script> </script>
<h1> <h1>
Interactive Content Interactive Content
</h1> </h1>
@ -91,21 +93,19 @@ elements under or nearby the event position and calls the click handler. Thus ge
can be disambiguated as moves, zooms. or taps. can be disambiguated as moves, zooms. or taps.
</p> </p>
<div id="main2" class="grayBorder interactive" style="position: relative; width: 100%; height: 280px;"> <div id="contentExample" class="grayBorder interactive" style="position: relative; width: 100%; height: 280px;">
<!-- Note that we need to set draggable to false to avoid conflicts. The DOM elements
must also be positioned absolutely. -->
<div id="interactiveContent"> <div id="interactiveContent">
<img draggable="false" style="position: absolute;" src="examples/women.jpeg" /> <img draggable="false" style="position: absolute;" src="examples/women.jpeg" />
<a style="position:absolute; top: 10px; right: 10px; color:white;" href="https://www.iwm-tuebingen.de" target="_blank">A Link</a> <a style="position:absolute; top: 10px; right: 10px; color:white;" href="javascript:alert('test link')">A Link</a>
<div onclick="alert('clicked')" style="position:absolute; top: 30px; right: 10px; color:white;">A Div with click handler</div> <div onclick="alert('div clicked')" style="position:absolute; top: 30px; right: 10px; color:white;">A Div with click handler</div>
</div> </div>
</div> </div>
<script class="doctest"> <script class="doctest">
let app2 = new App() let contentContainer = new DOMScatterContainer(contentExample)
let scatterContainer2 = new DOMScatterContainer(main2) new DOMScatter(interactiveContent, contentContainer, {
let scatter2 = new DOMScatter(interactiveContent, scatterContainer2, {
x: 44, x: 44,
y: 44, y: 44,
width: 274, width: 274,
@ -113,7 +113,7 @@ can be disambiguated as moves, zooms. or taps.
throwVisibility: 88, throwVisibility: 88,
minScale: 0.5, minScale: 0.5,
maxScale: 1.5}) maxScale: 1.5})
app2.run()
</script> </script>
</body> </body>

View File

@ -865,10 +865,11 @@ export class DOMScatterContainer {
* @param {String} [touchAction=none] - CSS to set touch action style, needed to prevent * @param {String} [touchAction=none] - CSS to set touch action style, needed to prevent
* pointer cancel events. Use null if the * pointer cancel events. Use null if the
* the touch action should not be set. * the touch action should not be set.
* @param {DOM node} debugCanvas - Shows debug infos about touches if not null
*/ */
constructor( constructor(
element, element,
{ stopEvents = 'auto', claimEvents = true, useCapture = true, touchAction = 'none' } = {} { stopEvents = 'auto', claimEvents = true, useCapture = true, touchAction = 'none', debugCanvas = null } = {}
) { ) {
this.onCapture = null this.onCapture = null
this.element = element this.element = element
@ -900,7 +901,7 @@ export class DOMScatterContainer {
mouseWheelElement: window mouseWheelElement: window
}) })
if (typeof debugCanvas !== 'undefined') { if (debugCanvas !== null) {
requestAnimationFrame(dt => { requestAnimationFrame(dt => {
this.showTouches(dt, debugCanvas) this.showTouches(dt, debugCanvas)
}) })