ios-inline-media-controls.js [plain text]
class IOSInlineMediaControls extends InlineMediaControls
{
constructor(options = {})
{
options.layoutTraits = LayoutTraits.iOS;
super(options);
this.element.classList.add("ios");
this._pinchGestureRecognizer = new PinchGestureRecognizer(this.element, this);
}
get showsStartButton()
{
return super.showsStartButton;
}
set showsStartButton(flag)
{
super.showsStartButton = flag;
if (!flag)
delete this._tapGestureRecognizer;
else if (!this._tapGestureRecognizer)
this._tapGestureRecognizer = new TapGestureRecognizer(this.element, this);
}
gestureRecognizerStateDidChange(recognizer)
{
if (recognizer === this._pinchGestureRecognizer)
this._pinchGestureRecognizerStateDidChange(recognizer);
else if (recognizer === this._tapGestureRecognizer)
this._tapGestureRecognizerStateDidChange(recognizer);
}
_pinchGestureRecognizerStateDidChange(recognizer)
{
if (recognizer.state !== GestureRecognizer.States.Ended && recognizer.state !== GestureRecognizer.States.Changed)
return;
if (recognizer.scale > IOSInlineMediaControls.MinimumScaleToEnterFullscreen && this.delegate && typeof this.delegate.iOSInlineMediaControlsRecognizedPinchInGesture === "function")
this.delegate.iOSInlineMediaControlsRecognizedPinchInGesture();
}
_tapGestureRecognizerStateDidChange(recognizer)
{
console.assert(this.showsStartButton);
if (recognizer.state === GestureRecognizer.States.Recognized && this.delegate && typeof this.delegate.iOSInlineMediaControlsRecognizedTapGesture === "function")
this.delegate.iOSInlineMediaControlsRecognizedTapGesture();
}
}
IOSInlineMediaControls.MinimumScaleToEnterFullscreen = 1.5;