Merge branch 'master' into obersalzberg
# Conflicts: # dist/iwmlib.js # dist/iwmlib.pixi.js
This commit is contained in:
Vendored
+42
-25
@@ -1518,7 +1518,7 @@
|
||||
return new Date(date.getTime() + 1)
|
||||
}
|
||||
|
||||
static * iterYears(start, end) {
|
||||
static *iterYears(start, end) {
|
||||
let date = this.create(start.getFullYear(), 0, 1);
|
||||
while (date <= end) {
|
||||
yield date;
|
||||
@@ -1527,7 +1527,7 @@
|
||||
yield date;
|
||||
}
|
||||
|
||||
static * iterMonths(year, limit = 12) {
|
||||
static *iterMonths(year, limit = 12) {
|
||||
let month = 0;
|
||||
while (month < limit) {
|
||||
let date = this.create(year.getFullYear(), month, 1);
|
||||
@@ -1536,7 +1536,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
static * iterMonthsOfYears(years) {
|
||||
static *iterMonthsOfYears(years) {
|
||||
for (let year of years) {
|
||||
for (let month of this.iterMonths(year)) {
|
||||
yield month;
|
||||
@@ -1544,7 +1544,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
static * iterDays(month) {
|
||||
static *iterDays(month) {
|
||||
let day = 1;
|
||||
let limit = Dates.daysInMonth(month);
|
||||
while (day <= limit) {
|
||||
@@ -1554,7 +1554,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
static * iterDaysOfMonths(months) {
|
||||
static *iterDaysOfMonths(months) {
|
||||
for (let month of months) {
|
||||
for (let day of this.iterDays(month)) {
|
||||
yield day;
|
||||
@@ -1732,16 +1732,12 @@
|
||||
static distanceToRect(p, r) {
|
||||
let dx = 0;
|
||||
let dy = 0;
|
||||
if (p.x < r.x)
|
||||
dx = p.x - r.x;
|
||||
else if (p.x > r.x + r.width)
|
||||
dx = p.x - (r.x + r.width);
|
||||
if (p.y < r.y)
|
||||
dy = p.y - r.y;
|
||||
else if (p.y > r.y + r.height)
|
||||
dy = p.y - (r.y + r.height);
|
||||
if (p.x < r.x) dx = p.x - r.x;
|
||||
else if (p.x > r.x + r.width) dx = p.x - (r.x + r.width);
|
||||
if (p.y < r.y) dy = p.y - r.y;
|
||||
else if (p.y > r.y + r.height) dy = p.y - (r.y + r.height);
|
||||
return Math.sqrt(dx * dx + dy * dy)
|
||||
/* let cx = Math.max(Math.min(p.x, r.x + r.width), r.x)
|
||||
/* let cx = Math.max(Math.min(p.x, r.x + r.width), r.x)
|
||||
let cy = Math.max(Math.min(p.y, r.y + r.height), r.y)
|
||||
let result = Math.sqrt((p.x - cx) * (p.x - cx) + (p.y - cy) * (p.y - cy))
|
||||
console.log("distanceToRect", p, r, result)
|
||||
@@ -2213,11 +2209,11 @@
|
||||
next(nextValue) {
|
||||
// push new value to the end, and remove oldest one
|
||||
let removed = this.__push(nextValue);
|
||||
// smooth value using all values from buffer
|
||||
// smooth value using all values from buffer
|
||||
let result = this.buffer.reduce((last, current) => {
|
||||
return this.smoothing * current + (1 - this.smoothing) * last
|
||||
}, removed);
|
||||
// replace smoothed value
|
||||
return this.smoothing * current + (1 - this.smoothing) * last
|
||||
}, removed);
|
||||
// replace smoothed value
|
||||
this.buffer[this.buffer.length - 1] = result;
|
||||
return result
|
||||
}
|
||||
@@ -3694,7 +3690,7 @@
|
||||
* @constructor
|
||||
* @param {object} [opts] - An options object to specify to style and behaviour of the popup.
|
||||
* @param {boolean} [opts.closeOnPopup=false] - Should the popup be closed when the user clicks on the popup?
|
||||
* @param {boolean} [opts.closeButton=true] - Should a close button be displayed on the upper right corner?
|
||||
* @param {boolean|string} [opts.closeButton=true] - Should a close button be displayed on the upper right corner? Alternatively, a URL to the image can be specified.
|
||||
* @param {object} [opts.button] - A Button object to be display on the lower right corner.
|
||||
* @param {object} [opts.buttonGroup] - A ButtonGroup object to be displayed on the lower right corner.
|
||||
*/
|
||||
@@ -3749,7 +3745,16 @@
|
||||
// closeButton
|
||||
//-----------------
|
||||
if (this.opts.closeButton) {
|
||||
let closeButton = PIXI.Sprite.from('../../assets/icons/close.png');
|
||||
let url = null;
|
||||
if (typeof this.opts.closeButton === 'string' || this.opts.closeButton instanceof String) {
|
||||
url = InteractivePopup.iconIsUrl(this.opts.closeButton)
|
||||
? this.opts.closeButton
|
||||
: `../../assets/icons/${this.opts.closeButton}.png`;
|
||||
} else {
|
||||
url = '../../assets/icons/close.png';
|
||||
}
|
||||
|
||||
let closeButton = PIXI.Sprite.from(url);
|
||||
closeButton.width = this.headerStyle.fontSize;
|
||||
closeButton.height = closeButton.width;
|
||||
closeButton.tint = this.theme.color2;
|
||||
@@ -3848,6 +3853,18 @@
|
||||
|
||||
return size
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests if an icon string is an url.
|
||||
*
|
||||
* @private
|
||||
* @static
|
||||
* @param {string} url - The url to test.
|
||||
* @return {boolean} true if the url is an url to an image.
|
||||
*/
|
||||
static iconIsUrl(url) {
|
||||
return /\.(png|svg|gif|jpg|jpeg|tif|tiff)$/i.test(url)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3873,7 +3890,7 @@
|
||||
*
|
||||
* @constructor
|
||||
* @param {object} [opts] - An options object to specify to style and behaviour of the popup.
|
||||
* @param {boolean} [opts.closeButton=false] - Should a close button be displayed on the upper right corner?
|
||||
* @param {boolean|string} [opts.closeButton=false] - Should a close button be displayed on the upper right corner? Alternatively, a URL to the image can be specified.
|
||||
* @param {number} [opts.minWidth=0] - The minimum width of the popup.
|
||||
* @param {number} [opts.minHeight=0] - The minimum height of the popup.
|
||||
*/
|
||||
@@ -7019,6 +7036,7 @@
|
||||
let delta = interaction.delta();
|
||||
|
||||
if (delta != null) {
|
||||
this.addVelocity(delta); // uo: reverted commit fa0256d782dd498c6d3e51321260ca375ca9f855
|
||||
let rotate = delta.rotate;
|
||||
let zoom = delta.zoom;
|
||||
if (this.maxRotation != null) {
|
||||
@@ -7218,7 +7236,7 @@
|
||||
}
|
||||
|
||||
_move(delta) {
|
||||
this.addVelocity(delta);
|
||||
// this.addVelocity(delta) uo: reverted commit fa0256d782dd498c6d3e51321260ca375ca9f855
|
||||
this.x += this.movableX ? delta.x : 0;
|
||||
this.y += this.movableX ? delta.y : 0;
|
||||
}
|
||||
@@ -7260,7 +7278,7 @@
|
||||
// this._move(offset)
|
||||
this.scale = newScale;
|
||||
this.rotation += rotate;
|
||||
let offset = Points.negate(offset);
|
||||
let offset = Points.negate(anchorOffset);
|
||||
offset = Points.add(offset, extra);
|
||||
offset = Points.add(offset, translate);
|
||||
this._move(Points.add(anchorOffset, offset));
|
||||
@@ -7853,7 +7871,7 @@
|
||||
}
|
||||
this._x = x;
|
||||
this._y = y;
|
||||
this.addVelocity({ x: delta.x, y: delta.y });
|
||||
// this.addVelocity({ x: delta.x, y: delta.y }) uo: reverted commit fa0256d782dd498c6d3e51321260ca375ca9f855
|
||||
TweenLite.set(this.element, { x, y });
|
||||
}
|
||||
|
||||
@@ -11779,7 +11797,6 @@
|
||||
if (y != null) this.y = y;
|
||||
}
|
||||
|
||||
|
||||
getWorldScatter() {
|
||||
return this
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user