|
|
@ -19,10 +19,16 @@ Object.defineProperty(exports, "__esModule", { |
|
|
|
}); |
|
|
|
}); |
|
|
|
exports.SecondaryToolbar = undefined; |
|
|
|
exports.SecondaryToolbar = undefined; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); |
|
|
|
|
|
|
|
|
|
|
|
var _ui_utils = require('./ui_utils'); |
|
|
|
var _ui_utils = require('./ui_utils'); |
|
|
|
|
|
|
|
|
|
|
|
var SecondaryToolbar = function SecondaryToolbarClosure() { |
|
|
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var SecondaryToolbar = function () { |
|
|
|
function SecondaryToolbar(options, mainContainer, eventBus) { |
|
|
|
function SecondaryToolbar(options, mainContainer, eventBus) { |
|
|
|
|
|
|
|
_classCallCheck(this, SecondaryToolbar); |
|
|
|
|
|
|
|
|
|
|
|
this.toolbar = options.toolbar; |
|
|
|
this.toolbar = options.toolbar; |
|
|
|
this.toggleButton = options.toggleButton; |
|
|
|
this.toggleButton = options.toggleButton; |
|
|
|
this.toolbarButtonContainer = options.toolbarButtonContainer; |
|
|
|
this.toolbarButtonContainer = options.toolbarButtonContainer; |
|
|
@ -87,31 +93,37 @@ var SecondaryToolbar = function SecondaryToolbarClosure() { |
|
|
|
this._bindHandToolListener(options.toggleHandToolButton); |
|
|
|
this._bindHandToolListener(options.toggleHandToolButton); |
|
|
|
this.eventBus.on('resize', this._setMaxHeight.bind(this)); |
|
|
|
this.eventBus.on('resize', this._setMaxHeight.bind(this)); |
|
|
|
} |
|
|
|
} |
|
|
|
SecondaryToolbar.prototype = { |
|
|
|
|
|
|
|
get isOpen() { |
|
|
|
_createClass(SecondaryToolbar, [{ |
|
|
|
return this.opened; |
|
|
|
key: 'setPageNumber', |
|
|
|
}, |
|
|
|
value: function setPageNumber(pageNumber) { |
|
|
|
setPageNumber: function SecondaryToolbar_setPageNumber(pageNumber) { |
|
|
|
|
|
|
|
this.pageNumber = pageNumber; |
|
|
|
this.pageNumber = pageNumber; |
|
|
|
this._updateUIState(); |
|
|
|
this._updateUIState(); |
|
|
|
}, |
|
|
|
} |
|
|
|
setPagesCount: function SecondaryToolbar_setPagesCount(pagesCount) { |
|
|
|
}, { |
|
|
|
|
|
|
|
key: 'setPagesCount', |
|
|
|
|
|
|
|
value: function setPagesCount(pagesCount) { |
|
|
|
this.pagesCount = pagesCount; |
|
|
|
this.pagesCount = pagesCount; |
|
|
|
this._updateUIState(); |
|
|
|
this._updateUIState(); |
|
|
|
}, |
|
|
|
} |
|
|
|
reset: function SecondaryToolbar_reset() { |
|
|
|
}, { |
|
|
|
|
|
|
|
key: 'reset', |
|
|
|
|
|
|
|
value: function reset() { |
|
|
|
this.pageNumber = 0; |
|
|
|
this.pageNumber = 0; |
|
|
|
this.pagesCount = 0; |
|
|
|
this.pagesCount = 0; |
|
|
|
this._updateUIState(); |
|
|
|
this._updateUIState(); |
|
|
|
}, |
|
|
|
} |
|
|
|
_updateUIState: function SecondaryToolbar_updateUIState() { |
|
|
|
}, { |
|
|
|
var items = this.items; |
|
|
|
key: '_updateUIState', |
|
|
|
items.firstPage.disabled = this.pageNumber <= 1; |
|
|
|
value: function _updateUIState() { |
|
|
|
items.lastPage.disabled = this.pageNumber >= this.pagesCount; |
|
|
|
this.items.firstPage.disabled = this.pageNumber <= 1; |
|
|
|
items.pageRotateCw.disabled = this.pagesCount === 0; |
|
|
|
this.items.lastPage.disabled = this.pageNumber >= this.pagesCount; |
|
|
|
items.pageRotateCcw.disabled = this.pagesCount === 0; |
|
|
|
this.items.pageRotateCw.disabled = this.pagesCount === 0; |
|
|
|
}, |
|
|
|
this.items.pageRotateCcw.disabled = this.pagesCount === 0; |
|
|
|
_bindClickListeners: function SecondaryToolbar_bindClickListeners() { |
|
|
|
} |
|
|
|
|
|
|
|
}, { |
|
|
|
|
|
|
|
key: '_bindClickListeners', |
|
|
|
|
|
|
|
value: function _bindClickListeners() { |
|
|
|
var _this = this; |
|
|
|
var _this = this; |
|
|
|
|
|
|
|
|
|
|
|
this.toggleButton.addEventListener('click', this.toggle.bind(this)); |
|
|
|
this.toggleButton.addEventListener('click', this.toggle.bind(this)); |
|
|
@ -135,14 +147,16 @@ var SecondaryToolbar = function SecondaryToolbarClosure() { |
|
|
|
for (var button in this.buttons) { |
|
|
|
for (var button in this.buttons) { |
|
|
|
_loop(button); |
|
|
|
_loop(button); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
} |
|
|
|
_bindHandToolListener: function SecondaryToolbar_bindHandToolListener(toggleHandToolButton) { |
|
|
|
}, { |
|
|
|
|
|
|
|
key: '_bindHandToolListener', |
|
|
|
|
|
|
|
value: function _bindHandToolListener(toggleHandToolButton) { |
|
|
|
var isHandToolActive = false; |
|
|
|
var isHandToolActive = false; |
|
|
|
this.eventBus.on('handtoolchanged', function (e) { |
|
|
|
this.eventBus.on('handtoolchanged', function (evt) { |
|
|
|
if (isHandToolActive === e.isActive) { |
|
|
|
if (isHandToolActive === evt.isActive) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
isHandToolActive = e.isActive; |
|
|
|
isHandToolActive = evt.isActive; |
|
|
|
if (isHandToolActive) { |
|
|
|
if (isHandToolActive) { |
|
|
|
toggleHandToolButton.title = _ui_utils.mozL10n.get('hand_tool_disable.title', null, 'Disable hand tool'); |
|
|
|
toggleHandToolButton.title = _ui_utils.mozL10n.get('hand_tool_disable.title', null, 'Disable hand tool'); |
|
|
|
toggleHandToolButton.firstElementChild.textContent = _ui_utils.mozL10n.get('hand_tool_disable_label', null, 'Disable hand tool'); |
|
|
|
toggleHandToolButton.firstElementChild.textContent = _ui_utils.mozL10n.get('hand_tool_disable_label', null, 'Disable hand tool'); |
|
|
@ -151,8 +165,10 @@ var SecondaryToolbar = function SecondaryToolbarClosure() { |
|
|
|
toggleHandToolButton.firstElementChild.textContent = _ui_utils.mozL10n.get('hand_tool_enable_label', null, 'Enable hand tool'); |
|
|
|
toggleHandToolButton.firstElementChild.textContent = _ui_utils.mozL10n.get('hand_tool_enable_label', null, 'Enable hand tool'); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
} |
|
|
|
open: function SecondaryToolbar_open() { |
|
|
|
}, { |
|
|
|
|
|
|
|
key: 'open', |
|
|
|
|
|
|
|
value: function open() { |
|
|
|
if (this.opened) { |
|
|
|
if (this.opened) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
@ -160,23 +176,29 @@ var SecondaryToolbar = function SecondaryToolbarClosure() { |
|
|
|
this._setMaxHeight(); |
|
|
|
this._setMaxHeight(); |
|
|
|
this.toggleButton.classList.add('toggled'); |
|
|
|
this.toggleButton.classList.add('toggled'); |
|
|
|
this.toolbar.classList.remove('hidden'); |
|
|
|
this.toolbar.classList.remove('hidden'); |
|
|
|
}, |
|
|
|
} |
|
|
|
close: function SecondaryToolbar_close() { |
|
|
|
}, { |
|
|
|
|
|
|
|
key: 'close', |
|
|
|
|
|
|
|
value: function close() { |
|
|
|
if (!this.opened) { |
|
|
|
if (!this.opened) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
this.opened = false; |
|
|
|
this.opened = false; |
|
|
|
this.toolbar.classList.add('hidden'); |
|
|
|
this.toolbar.classList.add('hidden'); |
|
|
|
this.toggleButton.classList.remove('toggled'); |
|
|
|
this.toggleButton.classList.remove('toggled'); |
|
|
|
}, |
|
|
|
} |
|
|
|
toggle: function SecondaryToolbar_toggle() { |
|
|
|
}, { |
|
|
|
|
|
|
|
key: 'toggle', |
|
|
|
|
|
|
|
value: function toggle() { |
|
|
|
if (this.opened) { |
|
|
|
if (this.opened) { |
|
|
|
this.close(); |
|
|
|
this.close(); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
this.open(); |
|
|
|
this.open(); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
} |
|
|
|
_setMaxHeight: function SecondaryToolbar_setMaxHeight() { |
|
|
|
}, { |
|
|
|
|
|
|
|
key: '_setMaxHeight', |
|
|
|
|
|
|
|
value: function _setMaxHeight() { |
|
|
|
if (!this.opened) { |
|
|
|
if (!this.opened) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
@ -187,7 +209,14 @@ var SecondaryToolbar = function SecondaryToolbarClosure() { |
|
|
|
this.toolbarButtonContainer.setAttribute('style', 'max-height: ' + (this.containerHeight - _ui_utils.SCROLLBAR_PADDING) + 'px;'); |
|
|
|
this.toolbarButtonContainer.setAttribute('style', 'max-height: ' + (this.containerHeight - _ui_utils.SCROLLBAR_PADDING) + 'px;'); |
|
|
|
this.previousContainerHeight = this.containerHeight; |
|
|
|
this.previousContainerHeight = this.containerHeight; |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}, { |
|
|
|
|
|
|
|
key: 'isOpen', |
|
|
|
|
|
|
|
get: function get() { |
|
|
|
|
|
|
|
return this.opened; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}]); |
|
|
|
|
|
|
|
|
|
|
|
return SecondaryToolbar; |
|
|
|
return SecondaryToolbar; |
|
|
|
}(); |
|
|
|
}(); |
|
|
|
|
|
|
|
|
|
|
|
exports.SecondaryToolbar = SecondaryToolbar; |
|
|
|
exports.SecondaryToolbar = SecondaryToolbar; |