Fixed worker path problems.

This commit is contained in:
2019-07-04 09:17:43 +02:00
parent da212ac188
commit 4e9dd2fa02
8 changed files with 260 additions and 67 deletions
+64 -58
View File
@@ -1402,6 +1402,8 @@
Events$1.simulated = [];
Events$1.simulationRunning = false;
/* global PIXI TweenLite */
/**
* Callback for the button action.
*
@@ -1559,7 +1561,7 @@
}
if (this.opts.style === 'link') {
Object.assign(this.opts, {strokeAlpha: 0, strokeActiveAlpha: 0, fillAlpha: 0, fillActiveAlpha: 0});
Object.assign(this.opts, { strokeAlpha: 0, strokeActiveAlpha: 0, fillAlpha: 0, fillActiveAlpha: 0 });
}
this._active = null;
@@ -1631,7 +1633,7 @@
//-----------------
this.button.on('pointerover', e => {
this.capture(e);
TweenLite.to([this.button, this.content], this.theme.fast, {alpha: .83, overwrite: 'none'});
TweenLite.to([this.button, this.content], this.theme.fast, { alpha: .83, overwrite: 'none' });
});
this.button.on('pointermove', e => {
@@ -1640,12 +1642,13 @@
this.button.on('pointerout', e => {
this.capture(e);
TweenLite.to([this.button, this.content], this.theme.fast, {alpha: 1, overwrite: 'none'});
TweenLite.to([this.button, this.content], this.theme.fast, { alpha: 1, overwrite: 'none' });
});
// eslint-disable-next-line no-unused-vars
this.button.on('pointerdown', e => {
//this.capture(e)
TweenLite.to([this.button, this.content], this.theme.fast, {alpha: .7, overwrite: 'none'});
TweenLite.to([this.button, this.content], this.theme.fast, { alpha: .7, overwrite: 'none' });
});
this.button.on('pointerup', e => {
@@ -1658,7 +1661,7 @@
this.opts.action.call(this, e, this);
}
TweenLite.to([this.button, this.content], this.theme.fast, {alpha: .83, overwrite: 'none'});
TweenLite.to([this.button, this.content], this.theme.fast, { alpha: .83, overwrite: 'none' });
if (this.opts.type === 'checkbox') {
this.active = !this.active;
@@ -1681,9 +1684,9 @@
//-----------------
if (this.opts.tooltip) {
if (typeof this.opts.tooltip === 'string') {
this.tooltip = new Tooltip({object: this, content: this.opts.tooltip});
this.tooltip = new Tooltip({ object: this, content: this.opts.tooltip });
} else {
this.opts.tooltip = Object.assign({}, {object: this}, this.opts.tooltip);
this.opts.tooltip = Object.assign({}, { object: this }, this.opts.tooltip);
this.tooltip = new Tooltip(this.opts.tooltip);
}
}
@@ -1698,7 +1701,7 @@
offsetTop: 0
});
if (typeof this.opts.badge === 'string') {
opts = Object.assign(opts, {content: this.opts.badge});
opts = Object.assign(opts, { content: this.opts.badge });
} else {
opts = Object.assign(opts, this.opts.badge);
}
@@ -1706,25 +1709,25 @@
const badge = new Badge(opts);
switch (opts.align) {
case 'left':
badge.x = this.x - badge.width / 2 + opts.offsetLeft;
break
case 'center':
badge.x = this.x + this.width / 2 - badge.width / 2 + opts.offsetLeft;
break
case 'right':
badge.x = this.x + this.width - badge.width / 2 + opts.offsetLeft;
case 'left':
badge.x = this.x - badge.width / 2 + opts.offsetLeft;
break
case 'center':
badge.x = this.x + this.width / 2 - badge.width / 2 + opts.offsetLeft;
break
case 'right':
badge.x = this.x + this.width - badge.width / 2 + opts.offsetLeft;
}
switch (opts.verticalAlign) {
case 'top':
badge.y = this.y - badge.height / 2 + opts.offsetTop;
break
case 'middle':
badge.y = this.y + this.height / 2 - badge.height / 2 + opts.offsetTop;
break
case 'bottom':
badge.y = this.y + this.height - badge.height / 2 + opts.offsetTop;
case 'top':
badge.y = this.y - badge.height / 2 + opts.offsetTop;
break
case 'middle':
badge.y = this.y + this.height / 2 - badge.height / 2 + opts.offsetTop;
break
case 'bottom':
badge.y = this.y + this.height - badge.height / 2 + opts.offsetTop;
}
this.addChild(badge);
@@ -1834,15 +1837,15 @@
for (let child of this.content.children) {
switch (this.opts.verticalAlign) {
case 'top':
child.y = 0;
break
case 'middle':
child.y = this.content.height / 2 - child.height / 2;
break
case 'bottom':
child.y = this.content.height - child.height;
break
case 'top':
child.y = 0;
break
case 'middle':
child.y = this.content.height / 2 - child.height / 2;
break
case 'bottom':
child.y = this.content.height - child.height;
break
}
}
@@ -1859,27 +1862,27 @@
layoutContent() {
switch (this.opts.align) {
case 'left':
this.content.x = this.opts.padding;
break
case 'center':
this.content.x = ((this._width - this.content.width) / 2);
break
case 'right':
this.content.x = this._width - this.opts.padding - this.content.width;
break
case 'left':
this.content.x = this.opts.padding;
break
case 'center':
this.content.x = ((this._width - this.content.width) / 2);
break
case 'right':
this.content.x = this._width - this.opts.padding - this.content.width;
break
}
switch (this.opts.verticalAlign) {
case 'top':
this.content.y = this.opts.padding;
break
case 'middle':
this.content.y = (this._height - this.content.height) / 2;
break
case 'bottom':
this.content.y = this._height - this.opts.padding - this.content.height;
break
case 'top':
this.content.y = this.opts.padding;
break
case 'middle':
this.content.y = (this._height - this.content.height) / 2;
break
case 'bottom':
this.content.y = this._height - this.opts.padding - this.content.height;
break
}
return this
@@ -8320,9 +8323,11 @@
**/
class WorkerTileLoader extends TileLoader {
constructor(tiles) {
constructor(tiles, workerPath) {
super(tiles);
let worker = this.worker = new Worker("../../lib/pixi/deepzoom/tileloader.js");
let worker = this.worker = new Worker(workerPath);
worker.onmessage = (event) => {
if (event.data.success) {
let { url, col, row, buffer } = event.data;
@@ -8414,10 +8419,11 @@
this.tileScale = scale;
this.fadeInTime = fadeInTime;
this.keep = false;
if (this.view.preferWorker && view.info.compression.length > 0)
this.loader = new WorkerTileLoader(this);
else
if (this.view.useWorker && view.info.compression && view.info.compression.length > 0) {
this.loader = new WorkerTileLoader(this, this.view.useWorker);
} else {
this.loader = new PIXITileLoader(this, view.info.compression);
}
this.interactive = false;
this._highlight = null;
@@ -9040,7 +9046,7 @@
world = null, // Defines the world bounds the images lives in
highResolution = true,
autoLoadTiles = true,
preferWorker = false,
useWorker = '',
minimumLevel = 0,
alpha = 1,
app = window.app
@@ -9051,7 +9057,7 @@
this.debug = debug;
this.shadow = shadow;
this.world = world;
this.preferWorker = preferWorker;
this.useWorker = useWorker;
this.resolution = highResolution
? Math.round(window.devicePixelRatio)
: 1;