|
@@ -21,6 +21,8 @@ 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 _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 _pdf_cursor_tools = require('./pdf_cursor_tools');
|
|
|
|
+
|
|
var _ui_utils = require('./ui_utils');
|
|
var _ui_utils = require('./ui_utils');
|
|
|
|
|
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
@@ -69,8 +71,14 @@ var SecondaryToolbar = function () {
|
|
eventName: 'rotateccw',
|
|
eventName: 'rotateccw',
|
|
close: false
|
|
close: false
|
|
}, {
|
|
}, {
|
|
- element: options.toggleHandToolButton,
|
|
|
|
- eventName: 'togglehandtool',
|
|
|
|
|
|
+ element: options.cursorSelectToolButton,
|
|
|
|
+ eventName: 'switchcursortool',
|
|
|
|
+ eventDetails: { tool: _pdf_cursor_tools.CursorTool.SELECT },
|
|
|
|
+ close: true
|
|
|
|
+ }, {
|
|
|
|
+ element: options.cursorHandToolButton,
|
|
|
|
+ eventName: 'switchcursortool',
|
|
|
|
+ eventDetails: { tool: _pdf_cursor_tools.CursorTool.HAND },
|
|
close: true
|
|
close: true
|
|
}, {
|
|
}, {
|
|
element: options.documentPropertiesButton,
|
|
element: options.documentPropertiesButton,
|
|
@@ -90,7 +98,7 @@ var SecondaryToolbar = function () {
|
|
this.previousContainerHeight = null;
|
|
this.previousContainerHeight = null;
|
|
this.reset();
|
|
this.reset();
|
|
this._bindClickListeners();
|
|
this._bindClickListeners();
|
|
- this._bindHandToolListener(options.toggleHandToolButton);
|
|
|
|
|
|
+ this._bindCursorToolsListener(options);
|
|
this.eventBus.on('resize', this._setMaxHeight.bind(this));
|
|
this.eventBus.on('resize', this._setMaxHeight.bind(this));
|
|
}
|
|
}
|
|
|
|
|
|
@@ -132,11 +140,16 @@ var SecondaryToolbar = function () {
|
|
var _buttons$button = _this.buttons[button],
|
|
var _buttons$button = _this.buttons[button],
|
|
element = _buttons$button.element,
|
|
element = _buttons$button.element,
|
|
eventName = _buttons$button.eventName,
|
|
eventName = _buttons$button.eventName,
|
|
- close = _buttons$button.close;
|
|
|
|
|
|
+ close = _buttons$button.close,
|
|
|
|
+ eventDetails = _buttons$button.eventDetails;
|
|
|
|
|
|
element.addEventListener('click', function (evt) {
|
|
element.addEventListener('click', function (evt) {
|
|
if (eventName !== null) {
|
|
if (eventName !== null) {
|
|
- _this.eventBus.dispatch(eventName, { source: _this });
|
|
|
|
|
|
+ var details = { source: _this };
|
|
|
|
+ for (var property in eventDetails) {
|
|
|
|
+ details[property] = eventDetails[property];
|
|
|
|
+ }
|
|
|
|
+ _this.eventBus.dispatch(eventName, details);
|
|
}
|
|
}
|
|
if (close) {
|
|
if (close) {
|
|
_this.close();
|
|
_this.close();
|
|
@@ -149,20 +162,18 @@ var SecondaryToolbar = function () {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}, {
|
|
}, {
|
|
- key: '_bindHandToolListener',
|
|
|
|
- value: function _bindHandToolListener(toggleHandToolButton) {
|
|
|
|
- var isHandToolActive = false;
|
|
|
|
- this.eventBus.on('handtoolchanged', function (evt) {
|
|
|
|
- if (isHandToolActive === evt.isActive) {
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- isHandToolActive = evt.isActive;
|
|
|
|
- if (isHandToolActive) {
|
|
|
|
- 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');
|
|
|
|
- } else {
|
|
|
|
- toggleHandToolButton.title = _ui_utils.mozL10n.get('hand_tool_enable.title', null, 'Enable hand tool');
|
|
|
|
- toggleHandToolButton.firstElementChild.textContent = _ui_utils.mozL10n.get('hand_tool_enable_label', null, 'Enable hand tool');
|
|
|
|
|
|
+ key: '_bindCursorToolsListener',
|
|
|
|
+ value: function _bindCursorToolsListener(buttons) {
|
|
|
|
+ this.eventBus.on('cursortoolchanged', function (evt) {
|
|
|
|
+ buttons.cursorSelectToolButton.classList.remove('toggled');
|
|
|
|
+ buttons.cursorHandToolButton.classList.remove('toggled');
|
|
|
|
+ switch (evt.tool) {
|
|
|
|
+ case _pdf_cursor_tools.CursorTool.SELECT:
|
|
|
|
+ buttons.cursorSelectToolButton.classList.add('toggled');
|
|
|
|
+ break;
|
|
|
|
+ case _pdf_cursor_tools.CursorTool.HAND:
|
|
|
|
+ buttons.cursorHandToolButton.classList.add('toggled');
|
|
|
|
+ break;
|
|
}
|
|
}
|
|
});
|
|
});
|
|
}
|
|
}
|