mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Use RequireJS in the viewer, examples and tests.
This commit is contained in:
parent
05b9d3730a
commit
85e95d34ed
17 changed files with 201 additions and 331 deletions
|
@ -12,22 +12,26 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/* globals PDFJS */
|
||||
|
||||
'use strict';
|
||||
|
||||
(function (root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define('pdfjs/display/text_layer', ['exports', 'pdfjs/shared/util'],
|
||||
factory);
|
||||
define('pdfjs/display/text_layer', ['exports', 'pdfjs/shared/util',
|
||||
'pdfjs/display/dom_utils', 'pdfjs/shared/global'], factory);
|
||||
} else if (typeof exports !== 'undefined') {
|
||||
factory(exports, require('../shared/util.js'));
|
||||
factory(exports, require('../shared/util.js'), require('./dom_utils.js'),
|
||||
require('../shared/global.js'));
|
||||
} else {
|
||||
factory((root.pdfjsDisplayTextLayer = {}), root.pdfjsSharedUtil);
|
||||
factory((root.pdfjsDisplayTextLayer = {}), root.pdfjsSharedUtil,
|
||||
root.pdfjsDisplayDOMUtils, root.pdfjsSharedGlobal);
|
||||
}
|
||||
}(this, function (exports, sharedUtil) {
|
||||
}(this, function (exports, sharedUtil, displayDOMUtils, sharedGlobal) {
|
||||
|
||||
var Util = sharedUtil.Util;
|
||||
var createPromiseCapability = sharedUtil.createPromiseCapability;
|
||||
var CustomStyle = displayDOMUtils.CustomStyle;
|
||||
var PDFJS = sharedGlobal.PDFJS;
|
||||
|
||||
/**
|
||||
* Text layer render parameters.
|
||||
|
@ -61,7 +65,7 @@ var renderTextLayer = (function renderTextLayerClosure() {
|
|||
textDiv.dataset.isWhitespace = true;
|
||||
return;
|
||||
}
|
||||
var tx = PDFJS.Util.transform(viewport.transform, geom.transform);
|
||||
var tx = Util.transform(viewport.transform, geom.transform);
|
||||
var angle = Math.atan2(tx[1], tx[0]);
|
||||
if (style.vertical) {
|
||||
angle += Math.PI / 2;
|
||||
|
@ -167,7 +171,7 @@ var renderTextLayer = (function renderTextLayerClosure() {
|
|||
transform = 'rotate(' + rotation + 'deg) ' + transform;
|
||||
}
|
||||
if (transform) {
|
||||
PDFJS.CustomStyle.setProp('transform' , textDiv, transform);
|
||||
CustomStyle.setProp('transform' , textDiv, transform);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
/* Copyright 2015 Mozilla Foundation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
NOTE: This file is created as a helper to expose all loaded internal exported
|
||||
members to global scope.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
(function (root) {
|
||||
for (var i in root) {
|
||||
if (/^pdfjs(Shared|Core|Display)/.test(i)) {
|
||||
var obj = root[i];
|
||||
for (var j in obj) {
|
||||
if (Object.getOwnPropertyDescriptor(root, j)) {
|
||||
continue; // ignoring if already set
|
||||
}
|
||||
root[j] = obj[j];
|
||||
}
|
||||
}
|
||||
}
|
||||
})(window);
|
Loading…
Add table
Add a link
Reference in a new issue