Removed Greensock ThrowPropsPlugin as an dependency.

This commit is contained in:
Sebastian Kupke 2019-03-29 09:11:21 +01:00
parent fe36b66dc5
commit 6c2ae3b433
3 changed files with 82 additions and 23 deletions

60
dist/iwmlib.pixi.js vendored
View File

@ -11306,8 +11306,8 @@
* @param {*} text
* @param {*} style
* @param {*} width
* @returns
* @memberof Hypenate
* @returns {string}
*/
static splitLines(text, style, width) {
const pixiStyle = new PIXI.TextStyle(style);
@ -11322,6 +11322,47 @@
}
}
class TextLabel extends PIXI.Text {
/**
*Creates an instance of TextLabel.
* @param {string} text - The string that you would like the text to display
* @param {object|PIXI.TextStyle} [style] - The style parameters
* @param {canvas}
* @memberof TextLabel
*/
constructor(text, style=null, canvas=null, { minZoom = 0.1, maxZoom = 10} = {}) {
super(text, style, canvas );
this.normFontSize = this.style.fontSize;
this.minZoom = minZoom;
this.maxZoom = maxZoom;
}
zoom(factor) {
let oldValue = parseFloat(this.style.fontSize) / this.normFontSize;
let value = oldValue * factor;
this.setZoom(value);
}
setZoom(value) {
let oldValue = parseFloat(this.style.fontSize) / this.normFontSize;
if (value > this.maxZoom) {
value = this.maxZoom;
}
if (value < this.minZoom) {
value = this.minZoom;
}
if (value != oldValue) {
this.style.fontSize = Math.max(value * this.normFontSize, 1);
}
}
setZoomAndScale(scale) {
this.scale.set(1 / scale);
this.setZoom(scale);
}
}
/**
* A specialization of the PIXI.Graphics class that allows to
* resuse and place labels across different layout variants
@ -11343,7 +11384,7 @@
}
_createText(label, fontInfo) {
return new PIXI.Text(label, fontInfo)
return new TextLabel(label, fontInfo)
}
@ -11360,7 +11401,7 @@
* maxHeight: {number} truncates text that needs more space and adds ellipsis
* maxWidth: {number} word wraps text using hyphenation if possible
* @param {*} [fontInfo=FontInfo.normal] - Defines PIXI.TextStyle attributes
* @returns {PIXI.Text} instance
* @returns {PIXI.Text} - instance
* @memberof LabeledGraphics
*/
ensureLabel(key, label, attrs = {}, fontInfo = FontInfo.normal) {
@ -11429,7 +11470,7 @@
* @param {*} text
* @param {*} style
* @param {*} [maxLines=Infinity]
* @returns
* @returns {string}
* @memberof LabeledGraphics
*/
truncateLabel(text, style, maxLines = Infinity) {
@ -11465,7 +11506,7 @@
* Returns the label for the given key.
*
* @param {*} key
* @returns
* @returns {Object}
* @memberof LabeledGraphics
*/
getLabel(key) {
@ -12195,8 +12236,10 @@
this.killTweens();
this.deltas = [];
this.validScroll();
if (typeof ThrowPropsPlugin != "undefined") {
ThrowPropsPlugin.track(this, 'delta');
}
}
onMove(event, interaction) {
let delta = interaction.delta();
@ -12212,8 +12255,11 @@
}
onEnd(event, interaction) {
if (typeof ThrowPropsPlugin != "undefined") {
let vel = ThrowPropsPlugin.getVelocity(this, 'delta');
ThrowPropsPlugin.untrack(this);
}
this.killTweens();
this.redraw();
@ -13863,8 +13909,10 @@
};
TweenLite.killTweensOf(this.container.position, {x: true, y: true});
if (typeof ThrowPropsPlugin != "undefined") {
ThrowPropsPlugin.track(this.container.position, 'x,y');
}
}
/**
*
@ -13917,6 +13965,7 @@
};
}
if (typeof ThrowPropsPlugin != "undefined") {
ThrowPropsPlugin.to(this.container.position, {
throwProps,
ease: Strong.easeOut,
@ -13924,6 +13973,7 @@
}, .8, .4);
}
}
}
/**
* Captures an event to inform InteractionMapper about processed events.

View File

@ -258,8 +258,10 @@ export default class List extends PIXI.Container {
}
TweenLite.killTweensOf(this.container.position, {x: true, y: true})
if (typeof ThrowPropsPlugin != "undefined") {
ThrowPropsPlugin.track(this.container.position, 'x,y')
}
}
/**
*
@ -312,6 +314,7 @@ export default class List extends PIXI.Container {
}
}
if (typeof ThrowPropsPlugin != "undefined") {
ThrowPropsPlugin.to(this.container.position, {
throwProps,
ease: Strong.easeOut,
@ -319,6 +322,7 @@ export default class List extends PIXI.Container {
}, .8, .4)
}
}
}
/**
* Captures an event to inform InteractionMapper about processed events.

View File

@ -745,8 +745,10 @@ export default class Timeline extends BitmapLabeledGraphics {
this.killTweens()
this.deltas = []
this.validScroll()
if (typeof ThrowPropsPlugin != "undefined") {
ThrowPropsPlugin.track(this, 'delta')
}
}
onMove(event, interaction) {
let delta = interaction.delta()
@ -762,8 +764,11 @@ export default class Timeline extends BitmapLabeledGraphics {
}
onEnd(event, interaction) {
if (typeof ThrowPropsPlugin != "undefined") {
let vel = ThrowPropsPlugin.getVelocity(this, 'delta')
ThrowPropsPlugin.untrack(this)
}
this.killTweens()
this.redraw()