Browse Source

Minor updates to Doctests.

obersalzberg
Uwe Oestermeier 1 year ago
parent
commit
0e8c62eb4b
4 changed files with 24 additions and 5 deletions
  1. +15
    -0
      dist/iwmlib.js
  2. +2
    -1
      lib/bundle.js
  3. +4
    -2
      lib/card/index.html
  4. +3
    -2
      lib/scatter.html

+ 15
- 0
dist/iwmlib.js View File

@ -2974,6 +2974,20 @@
/* eslint-disable no-unused-vars */
/** This interface allows scatters to delegate tap events to other objects. */
class ITapDelegate extends Interface {
/** This method must be defined by the delegate. It handles the tap event. */
tap(event) {
}
/** Tells the delegate that it should handle standard click events. */
handleClicks() {
}
}
/**
* A base class for scatter specific events.
*
@ -7737,6 +7751,7 @@
window.IApp = IApp;
window.IInteractionMapperTarget = IInteractionMapperTarget;
window.IInteractionTarget = IInteractionTarget;
window.ITapDelegate = ITapDelegate;
window.Index = Index;
window.Inspect = Inspect;
window.Interaction = Interaction;

+ 2
- 1
lib/bundle.js View File

@ -15,7 +15,7 @@ import {EventRecorder} from './events.js'
import {FrameContainer, FrameTarget} from './frames.js'
import {Inspect} from './inspect.js'
import {PointMap, InteractionPoints, Interaction, IInteractionTarget, InteractionDelta, InteractionMapper, InteractionDelegate, IInteractionMapperTarget} from './interaction.js'
import {ResizeEvent, DOMScatterContainer, AbstractScatter, DOMScatter, ScatterEvent, BaseEvent} from './scatter.js'
import {ITapDelegate, ResizeEvent, DOMScatterContainer, AbstractScatter, DOMScatter, ScatterEvent, BaseEvent} from './scatter.js'
import {Cycle, Colors, Elements, Angle, Dates, Points, Polygon, Rect, Sets, Strings, isEmpty, getId, lerp, debounce, randomInt, randomFloat, LowPassFilter} from './utils.js'
import UITest from './uitest.js'
@ -54,6 +54,7 @@ window.FrameTarget = FrameTarget
window.IApp = IApp
window.IInteractionMapperTarget = IInteractionMapperTarget
window.IInteractionTarget = IInteractionTarget
window.ITapDelegate = ITapDelegate
window.Index = Index
window.Inspect = Inspect
window.Interaction = Interaction

+ 4
- 2
lib/card/index.html View File

@ -76,6 +76,8 @@
<script class="doctest">
Doctest.expect(ITapDelegate.implementedBy(CardWrapper), true)
const wrapper1 = new CardWrapper(demoCardWithOnClick)
wrapper1.handleClicksAsTaps()
@ -92,8 +94,8 @@
<h2>
Using Cards within Scatters
</h2>
<p>Cards can be used within scatters. Since the CardWrapper implements the TapDelegate protocol they can simply
be attached to a DOMScatter object.
<p>Cards can be used within scatters. Since the <code>CardWrapper</code> implements the <code>ITapDelegate</code> protocol they can simply
be attached to a DOMScatter object. See the <a href="../scatter.html">Scatter Doctest</a>.
</p>
<div class="interactive grayBorder" style="position: relative;">
</div>

+ 3
- 2
lib/scatter.html View File

@ -90,7 +90,8 @@ elements under or nearby the event position and calls the click handler. Thus ge
can be disambiguated as moves, zooms. or taps.
Note that on touch devices you can tap beside the object if you use an object that implements the ITapDelegate interface.
An ITapDelegate allowes a distance that can be configured by allowClickDistance. The default value is 44px.
An ITapDelegate allowes a distance that can be configured by allowClickDistance. The default value is 44px but here we
use 88px.
</p>
<div id="contentExample" class="grayBorder interactive" style="position: relative; width: 100%; height: 280px;">
@ -111,7 +112,7 @@ An ITapDelegate allowes a distance that can be configured by allowClickDistance.
let contentContainer = new DOMScatterContainer(contentExample)
let tapDelegate = new CardWrapper(interactiveContent)
let tapDelegate = new CardWrapper(interactiveContent, { allowClickDistance: 88})
new DOMScatter(interactiveContent, contentContainer, {
x: 44,
y: 44,

Loading…
Cancel
Save