this.visibleTime = 5000;
this.interfaceVisible = false;
+ this.maskToggleEventsTimeout = Date.now();
+
this.init();
}
},
initArrowsVisibilityManagement: function () {
+ console.log('init arrows visi manag');
var $this = this;
this.getInterfaceSelector().addClass('interfacecomponent');
- $(document).on('click', '#z', function () {
- $this.toggleInterface();
- return true;
- });
-
if (this.autoHideArrows()) {
- $(document).on('click', ':not(a)', function () {
- var selector = '#background,header,footer';
- if (!$(this).is(selector) && $(this).closest(selector).length === 0) {
+ if (this.fluidbook.touch) {
+ this.fluidbook.touch.hm.on('singletap', function (event) {
+ var target = $(event.target);
+ if (target.is('a') || target.closest('a').length > 0) {
+ return true;
+ }
+ $this.toggleInterface(1000);
return true;
- }
- $this.toggleInterface();
- return true;
- });
+ });
+ } else {
+ $(document).on('click', ':not(a)', function () {
+ var selector = '#fluidbook';
+ if (!$(this).is(selector) && $(this).closest(selector).length === 0) {
+ console.log('nok', $(this));
+ return true;
+ }
+ console.log('ok', $(this));
+ $this.toggleInterface(1000);
+ return true;
+ });
+ }
}
$(this.fluidbook).on('fluidbook.ready', function () {
this.checkHidden();
},
- toggleInterface: function () {
+ toggleInterface: function (mask) {
+ if (mask === undefined) {
+ mask = 0;
+ }
+
+ var now = Date.now();
+ if (now < this.maskToggleEventsTimeout) {
+ return;
+ }
+ if (mask > 0) {
+ this.maskToggleEventsTimeout = Math.max(this.maskToggleEventsTimeout, Date.now() + mask);
+ }
+
if (this.interfaceVisible && this.autoHideArrows()) {
return this.hideInterface();
} else {
},
initInteract: function () {
+ var tapEnabled = true;
var pinchEnabled = true;
var doubletapEnabled = true;
var panEnabled = true;
var $this = this;
- if (!doubletapEnabled && !panEnabled && !pinchEnabled) {
+ if (!tapEnabled && !doubletapEnabled && !panEnabled && !pinchEnabled) {
return;
}
Hammer.defaults.touchAction = options.touchAction;
var hm = new Hammer.Manager(document.getElementById('main'), options);
+ this.hm = hm;
if (doubletapEnabled) {
hm.add(new Hammer.Tap({event: 'doubletap', taps: 2, interval: 500}));
}
+ if (tapEnabled) {
+ hm.add(new Hammer.Tap({event: 'singletap', taps: 1, interval: 500}));
+ }
+
if (pinchEnabled) {
hm.add(new Hammer.Pinch({threshold: 0}));
hm.get('pinch').set({enable: true});