igniteui-angular-core
Version:
Ignite UI Angular Core logic used in multiple UI components.
1,021 lines (1,020 loc) • 34.8 kB
JavaScript
/*
THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE AGREEMENT ("AGREEMENT") LOCATED HERE:
https://www.infragistics.com/legal/license/igultimate-la
https://www.infragistics.com/legal/license/igultimate-eula
GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE: you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company.
*/
import { __extends } from "tslib";
import { Base, runOn, Delegate_$type, markType, typeCast, INotifyPropertyChanged_$type, PropertyChangedEventArgs, EventArgs, Point_$type, markDep } from "./type";
import { ISchedulableRender_$type } from "./ISchedulableRender";
import { List$1 } from "./List$1";
import { Image } from "./Image";
import { RenderingContext } from "./RenderingContext";
import { Dictionary$2 } from "./Dictionary$2";
import { Tile } from "./Tile";
import { Rect } from "./Rect";
import { CanvasRenderScheduler } from "./CanvasRenderScheduler";
import { StackPool$1 } from "./StackPool$1";
import { WriteableBitmap } from "./WriteableBitmap";
import { Uri } from "./Uri";
import { CancellingMultiScaleImageEventArgs } from "./CancellingMultiScaleImageEventArgs";
import { DownloadingMultiScaleImageEventArgs } from "./DownloadingMultiScaleImageEventArgs";
import { CanvasViewRenderer } from "./CanvasViewRenderer";
import { truncate, intDivide, logBase } from "./number";
import { DependencyObject } from "./DependencyObject";
import { Control } from "./Control";
import { DependencyProperty } from "./DependencyProperty";
import { IEasingFunction_$type } from "./IEasingFunction";
import { LRUCache$2 } from "./LRUCache$2";
import { TilePositionComparer } from "./TilePositionComparer";
import { Convert } from "./Convert";
import { MathUtil } from "./MathUtil";
import { PropertyMetadata } from "./PropertyMetadata";
import { stringIsNullOrEmpty } from "./string";
import { dateNow } from "./date";
/**
* @hidden
*/
var XamMultiScaleImageView = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(XamMultiScaleImageView, _super);
function XamMultiScaleImageView(a) {
var _this = _super.call(this) || this;
_this.b = null;
_this.h = null;
_this.g = new Dictionary$2(Base.$, List$1.$.specialize(Delegate_$type), 0);
_this.j = new List$1(Tile.$, 0);
_this.i = new List$1(Tile.$, 0);
_this.p = -1;
_this.o = -1;
_this.k = null;
_this.m = null;
_this.c = null;
_this._isDirty = false;
_this.au = Rect.empty;
_this.l = null;
_this.b = a;
_this.b.ag.o(_this);
_this.h = new List$1(Image.$, 0);
_this.b.ap = ((function () {
var $ret = new StackPool$1(Image.$);
$ret.j = runOn(_this, _this.at);
$ret.b = runOn(_this, _this.y);
$ret.c = runOn(_this, _this.aa);
$ret.d = runOn(_this, _this.z);
return $ret;
})());
for (var b = 0; b < 4; ++b) {
_this.i.add(null);
}
return _this;
}
XamMultiScaleImageView.prototype.at = function () {
return new Image();
};
XamMultiScaleImageView.prototype.y = function (a) {
this.h.add(a);
};
XamMultiScaleImageView.prototype.aa = function (a) {
this.h.remove(a);
};
XamMultiScaleImageView.prototype.z = function (a) {
};
XamMultiScaleImageView.prototype.ao = function (a, b, c) {
a.n = b;
a.o = c;
};
XamMultiScaleImageView.prototype.r = function (a) {
var _loop_1 = function (b) {
if (a == this_1.i._inner[b]) {
if (a.i != null && a.i.ac != null) {
var c = a.i.ac;
var d_1 = c.c;
var e_1 = this_1.b.ao.w(a.f + 8, a.d, a.e);
if (e_1 != null) {
var f = ((function () {
var $ret = new CancellingMultiScaleImageEventArgs();
$ret.uri = e_1.value;
$ret.image = d_1;
return $ret;
})());
this_1.b.bu(f);
}
if (this_1.g.containsKey(d_1)) {
var g = this_1.g.item(d_1);
for (var h = 0; h < g.count; h++) {
g._inner[h]();
}
g.clear();
this_1.g.removeItem(d_1);
}
}
this_1.i._inner[b] = null;
this_1.q();
return { value: void 0 };
}
};
var this_1 = this;
for (var b = 0; b < this.i.count; ++b) {
var state_1 = _loop_1(b);
if (typeof state_1 === "object")
return state_1.value;
}
for (var i = 0; i < this.j.count; ++i) {
if (this.j._inner[i] == a) {
this.j.removeAt(i);
break;
}
}
};
XamMultiScaleImageView.prototype.u = function (a) {
this.j.add(a);
this.j.aa(function (b, c) {
var d = 0;
var e = 0;
if (b.h != null) {
d = b.h.ac.b;
}
if (c.h != null) {
e = c.h.ac.b;
}
if (d < e) {
return -1;
}
else if (d > e) {
return 1;
}
return 0;
});
this.q();
};
XamMultiScaleImageView.prototype.q = function () {
var _this = this;
var index_ = -1;
if (this.l == null) {
return;
}
if (this.j.count > 0) {
for (var a = 0; a < this.i.count; ++a) {
if (this.i._inner[a] == null) {
index_ = a;
break;
}
}
}
if (index_ >= 0) {
this.i._inner[index_] = this.j._inner[0];
var b = new WriteableBitmap(this.b.ao.r, this.b.ao.p);
this.i._inner[index_].i.ac = b;
var ele_ = this.l.createElement("img");
var c_1 = ele_.getNativeElement();
b.c = c_1;
var self_ = this;
var d = new List$1(Delegate_$type, 0);
this.g.addItem(c_1, d);
d.add(ele_.listen("load", function (e) { return _this.ab(e, index_); }));
d.add(ele_.listen("readystatechange", function (e) { return _this.ab(e, index_); }));
d.add(ele_.listen("error", function (e) { return _this.ac(e, index_); }));
this.j.removeAt(0);
var e = this.b.ao.w(this.i._inner[index_].f + 8, this.i._inner[index_].d, this.i._inner[index_].e);
if (e == null) {
return;
}
var f_1 = e.value;
var g = ((function () {
var $ret = new DownloadingMultiScaleImageEventArgs();
$ret.uri = f_1;
$ret.image = c_1;
return $ret;
})());
this.b.bv(g);
f_1 = g.uri;
if (f_1 != null) {
c_1.src = f_1;
}
}
};
XamMultiScaleImageView.prototype.ab = function (a, b) {
var e_ = a.originalEvent;
var img_ = (e_.target);
var c = (img_.complete || (img_.readyState == 'complete' && e_.type == 'readystatechange'));
if (c) {
this.downloadCompleted(a, b);
}
};
XamMultiScaleImageView.prototype.ac = function (a, b) {
this.downloadError(a, b);
};
XamMultiScaleImageView.prototype.downloadError = function (a, b) {
var c = this.i._inner[b];
this.i._inner[b] = null;
if (c != null && c.i != null && c.i.ac != null) {
var e_ = a.originalEvent;
var d = (e_.target);
if (this.g.containsKey(d)) {
var e = this.g.item(d);
for (var f = 0; f < e.count; f++) {
e._inner[f]();
}
e.clear();
this.g.removeItem(d);
}
}
this.q();
this.ad();
};
XamMultiScaleImageView.prototype.downloadCompleted = function (a, b) {
var c = this.i._inner[b];
var d = true;
if (c != null && c.i != null && c.i.ac != null) {
d = false;
var ele_ = c.i.ac.c;
if (!ele_.complete) {
d = true;
}
if ((ele_.width == 0 && ele_.height == 0)) {
d = true;
}
}
this.i._inner[b] = null;
if (d) {
this.q();
this.ad();
return;
}
var e_ = a.originalEvent;
var e = (e_.target);
if (this.g.containsKey(e)) {
var f = this.g.item(e);
for (var g = 0; g < f.count; g++) {
f._inner[g]();
}
f.clear();
this.g.removeItem(e);
}
this.b.bo(c, c.i.ac);
if (c.i != null) {
this.b.ca(c);
}
this.q();
this.ad();
};
XamMultiScaleImageView.prototype.a = function (a, b, c, d) {
var e = new WriteableBitmap(a, a);
e.c = b.c;
if (!b.d.isEmpty) {
c += truncate(Math.round(b.d.left));
d += truncate(Math.round(b.d.top));
}
e.d = new Rect(0, c, d, a, a);
return e;
};
XamMultiScaleImageView.prototype.am = function (a) {
a.s = 0;
};
XamMultiScaleImageView.prototype.an = function (a) {
a.s = 1;
};
XamMultiScaleImageView.prototype.f = function () {
return true;
};
XamMultiScaleImageView.prototype.s = function (a) {
if (this.b.al != null) {
this.b.al.deferredRefresh();
}
else {
if (this.k != null) {
this.k.setTimeout(a, 0);
}
else {
window.setTimeout(a, 0);
}
}
};
XamMultiScaleImageView.prototype.aq = function () {
if (this.p == -1) {
this.p = window.setInterval(runOn(this.b, this.b.b9), 50);
}
};
XamMultiScaleImageView.prototype.as = function () {
if (this.p != -1) {
window.clearInterval(this.p);
this.p = -1;
}
};
XamMultiScaleImageView.prototype.ap = function () {
if (this.o == -1) {
this.o = window.setInterval(runOn(this.b, this.b.br), 50);
}
};
XamMultiScaleImageView.prototype.ar = function () {
if (this.o != -1) {
window.clearInterval(this.o);
this.o = -1;
}
};
XamMultiScaleImageView.prototype.t = function () {
if (this.p != -1) {
this.ar();
this.b.by();
}
};
XamMultiScaleImageView.prototype.ae = function (a) {
this.k = a;
this.k.rootWrapper.setStyleProperty("position", "relative");
this.m = this.k.createElement("canvas");
this.m.setStyleProperty("position", "absolute");
this.m.setStyleProperty("top", "0px");
this.m.setStyleProperty("left", "0px");
this.k.append(this.m);
this.c = new RenderingContext(new CanvasViewRenderer(), this.k.get2DCanvasContext(this.m));
this.af(this.k.rootWrapper.width(), this.k.rootWrapper.height());
};
XamMultiScaleImageView.prototype.af = function (a, b) {
this.m.setAttribute("width", truncate((a * this.b.a4)).toString());
this.m.setAttribute("height", truncate((b * this.b.a4)).toString());
this.m.setStyleProperty("width", a.toString() + "px");
this.m.setStyleProperty("height", b.toString() + "px");
this.b.cn = new Rect(0, 0, 0, a, b);
this.b.b5();
};
XamMultiScaleImageView.prototype.aj = function () {
this.ad();
};
Object.defineProperty(XamMultiScaleImageView.prototype, "index", {
get: function () {
return 0;
},
enumerable: false,
configurable: true
});
XamMultiScaleImageView.prototype.postRender = function () {
};
Object.defineProperty(XamMultiScaleImageView.prototype, "isDirty", {
get: function () {
return this._isDirty;
},
set: function (a) {
this._isDirty = a;
},
enumerable: false,
configurable: true
});
XamMultiScaleImageView.prototype.ad = function () {
if (this.c == null) {
return;
}
if (!this.isDirty) {
this.isDirty = true;
this.b.ag.q();
}
};
XamMultiScaleImageView.prototype.undirty = function (a) {
this.isDirty = false;
this.ak();
};
XamMultiScaleImageView.prototype.ak = function () {
if (this.c == null) {
return;
}
if (this.c.d && this.b.a4 != 1) {
this.c.aa();
this.c.ab(this.b.a4, this.b.a4);
}
if (!this.au.isEmpty) {
this.c.l(this.au.left, this.au.top, this.au.width, this.au.height);
}
this.au = this.b.cn;
for (var a = 0; a < this.h.count; a++) {
var b = this.h._inner[a];
if (b.s == 0) {
this.al(b);
}
}
for (var c = 0; c < this.h.count; c++) {
var d = this.h._inner[c];
if (d.s == 1) {
this.al(d);
}
}
if (this.c.d && this.b.a4 != 1) {
this.c.z();
}
this.b.bt();
this.b.bw();
};
XamMultiScaleImageView.prototype.d = function () {
var a = true;
for (var b = 0; b < this.i.count; b++) {
if (this.i._inner[b] != null) {
a = false;
}
}
return a;
};
XamMultiScaleImageView.prototype.al = function (a) {
if (this.c == null) {
return;
}
var b = a.ac;
var c = a._opacity * this.b._opacity;
if (b == null || b.c == null) {
return;
}
if (this.e(b.c)) {
return;
}
if (!b.d.isEmpty) {
if (b.d.width < 1 || b.d.height < 1) {
return;
}
this.c.o(b.c, c, b.d.left, b.d.top, b.d.width, b.d.height, Math.round(a.n + this.b.cn.left), Math.round(a.o + this.b.cn.top), a.width, a.height);
}
else {
this.c.n(b.c, c, Math.round(a.n + this.b.cn.left), Math.round(a.o + this.b.cn.top), a.width, a.height);
}
};
XamMultiScaleImageView.prototype.e = function (a) {
var img_ = a;
if (!img_.complete) {
return true;
}
if ((img_.width == 0 && img_.height == 0)) {
return true;
}
return false;
};
XamMultiScaleImageView.prototype.x = function () {
this.ad();
};
XamMultiScaleImageView.prototype.ag = function (a) {
this.c = a;
this.ad();
};
XamMultiScaleImageView.prototype.ah = function (a) {
this.l = a;
this.q();
};
XamMultiScaleImageView.prototype.ai = function (a) {
this.b.cn = a;
this.b.b5();
};
XamMultiScaleImageView.prototype.preRender = function () {
};
XamMultiScaleImageView.prototype.isValid = function () {
return true;
};
XamMultiScaleImageView.$t = markType(XamMultiScaleImageView, 'XamMultiScaleImageView', Base.$, [ISchedulableRender_$type]);
return XamMultiScaleImageView;
}(Base));
export { XamMultiScaleImageView };
/**
* @hidden
*/
var XamMultiScaleTileSource = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(XamMultiScaleTileSource, _super);
function XamMultiScaleTileSource(a, b, c, d, e) {
var _this = _super.call(this) || this;
_this.t = 0;
_this.s = 0;
_this.n = 1;
_this.l = false;
_this.r = 0;
_this.p = 0;
_this.q = 0;
_this.j = null;
_this.t = a;
_this.s = b;
_this.r = c;
_this.p = d;
_this.q = e;
return _this;
}
Object.defineProperty(XamMultiScaleTileSource.prototype, "v", {
get: function () {
return this.t;
},
set: function (a) {
this.t = a;
this.y(0, 0, 0, 0);
},
enumerable: false,
configurable: true
});
Object.defineProperty(XamMultiScaleTileSource.prototype, "u", {
get: function () {
return this.s;
},
set: function (a) {
this.s = a;
this.y(0, 0, 0, 0);
},
enumerable: false,
configurable: true
});
Object.defineProperty(XamMultiScaleTileSource.prototype, "o", {
get: function () {
return this.n;
},
set: function (a) {
this.n = a;
if (this.k != null) {
this.k._opacity = this.n;
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(XamMultiScaleTileSource.prototype, "m", {
get: function () {
return this.l;
},
set: function (a) {
this.l = a;
if (this.k != null) {
this.k.av = this.l;
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(XamMultiScaleTileSource.prototype, "k", {
get: function () {
return this.j;
},
set: function (a) {
this.j = a;
if (this.j != null) {
this.j._opacity = this.o;
}
},
enumerable: false,
configurable: true
});
XamMultiScaleTileSource.prototype.w = function (a, b, c) {
var d = new List$1(Base.$, 0);
this.x(a, b, c, d);
var e = null;
if (d.count > 0) {
e = typeCast(Uri.$, d._inner[0]);
}
return e;
};
XamMultiScaleTileSource.prototype.y = function (a, b, c, d) {
if (this.k != null) {
this.k.bs(a, b, c, d);
}
};
XamMultiScaleTileSource.$t = markType(XamMultiScaleTileSource, 'XamMultiScaleTileSource', DependencyObject.$);
return XamMultiScaleTileSource;
}(DependencyObject));
export { XamMultiScaleTileSource };
/**
* @hidden
*/
var XamMultiScaleImage = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(XamMultiScaleImage, _super);
function XamMultiScaleImage() {
var _this = _super.call(this) || this;
_this.ap = null;
_this.an = null;
_this.ak = null;
_this.ck = null;
_this.a2 = 0;
_this.at = false;
_this.propertyChanged = null;
_this.ba = 0;
_this.bb = 0;
_this.a0 = new Date();
_this.cl = null;
_this.a3 = 0;
_this.ay = new List$1(Tile.$, 0);
_this.aw = false;
_this.aq = new LRUCache$2(Tile.$, WriteableBitmap.$, 1, 0x7FFFFFFF, new TilePositionComparer());
_this.az = new List$1(Tile.$, 0);
_this.imageTilesReady = null;
_this.as = false;
_this.cn = null;
_this.ag = null;
_this.imagesChanged = null;
_this.downloadingImage = null;
_this.cancellingImage = null;
_this.a1 = 1;
_this.cn = Rect.empty;
_this.ag = new CanvasRenderScheduler();
_this.an = new XamMultiScaleImageView(_this);
_this.ab = XamMultiScaleImage.$;
_this.ck = _this.cm;
_this.a2 = _this.a5;
return _this;
}
Object.defineProperty(XamMultiScaleImage.prototype, "al", {
get: function () {
return this.ak;
},
set: function (a) {
if (this.ak != null) {
this.ak.unRegister(this);
}
this.ak = a;
if (this.ak != null) {
this.ak.register(this, runOn(this, this.b6));
}
},
enumerable: false,
configurable: true
});
XamMultiScaleImage.prototype.bc = function () {
if (!stringIsNullOrEmpty(this.bf)) {
return this.bf;
}
return null;
};
XamMultiScaleImage.prototype.bd = function () {
if (!stringIsNullOrEmpty(this.bj)) {
return this.bj;
}
return null;
};
XamMultiScaleImage.prototype.bx = function (a, b, c) {
var d = new PropertyChangedEventArgs(a);
if (this.propertyChanged != null) {
this.propertyChanged(this, d);
}
switch (a) {
case XamMultiScaleImage.$$p[2]:
if (this.ao != null) {
this.ao.k = this;
}
this.b4();
this.b7();
this.b5();
break;
case XamMultiScaleImage.$$p[6]:
this.b8();
break;
case XamMultiScaleImage.$$p[7]:
this.b8();
break;
case XamMultiScaleImage.$$p[4]:
if (!this.ax) {
this.an.t();
}
break;
case XamMultiScaleImage.$$p[0]:
this.at = this.av;
this.b5();
break;
}
};
XamMultiScaleImage.prototype.v = function () {
_super.prototype.v.call(this);
this.b5();
};
XamMultiScaleImage.prototype.b7 = function () {
this.cb();
if (this.ao != null) {
this.ba = Convert.toInt32(logBase(this.ao.r, 2));
this.bb = Convert.toInt32(logBase(this.ao.v, 2));
}
};
XamMultiScaleImage.prototype.bs = function (a, b, c, d) {
this.b4();
this.b7();
this.b5();
};
XamMultiScaleImage.prototype.b8 = function () {
if (this.ax) {
this.a0 = dateNow();
this.cl = this.ck;
this.a3 = this.a2;
this.an.aq();
}
else {
this.ck = this.cm;
this.a2 = this.a5;
this.b5();
}
};
XamMultiScaleImage.prototype.b9 = function () {
var a = 2;
var b = dateNow().getTime() - this.a0.getTime();
var c = b / 1000;
var d = MathUtil.d((c) / a, 0, 1);
var e = this.aj != null ? this.aj.ease(d) : d;
var f = 1 - e;
this.a2 = this.a3 * f + this.a5 * e;
this.ck = { $type: Point_$type, x: this.cl.x * f + this.cm.x * e, y: this.cl.y * f + this.cm.y * e };
if (d >= 1) {
this.an.as();
}
else {
}
this.b5();
};
XamMultiScaleImage.prototype.a8 = function (a, b, c, d) {
for (var e = 0; e < this.ay.count; ++e) {
if (this.ay._inner[e].c == a && this.ay._inner[e].d == b && this.ay._inner[e].e == c && this.ay._inner[e].f == d) {
return e;
}
}
return -1;
};
XamMultiScaleImage.prototype.b6 = function (a) {
var _this = this;
this.aw = false;
this.as = false;
var b = this.at;
if (this.ao == null || !this.an.f() || this.cn.width == 0 || this.cn.height == 0) {
return;
}
var c = truncate(Math.ceil(this.cn.width / this.ao.r));
var d = truncate(Math.max(1, Math.floor(-logBase(this.a2 / c, 2))));
if (d >= this.bb - 8) {
d = (this.bb - 8) - 1;
}
var e = truncate(Math.round(Math.pow(2, d)));
var f = this.a2;
var g = this.cn.height * f / this.cn.width;
var h = this.ao.v / Math.pow(2, d);
var i = this.ao.u / Math.pow(2, d);
var j = truncate(Math.floor((this.ck.x * this.ao.v) / h));
var k = truncate(Math.ceil(((this.ck.x + f) * this.ao.v) / h));
var l = truncate(Math.floor((this.ck.y * this.ao.u) / i));
var m = truncate(Math.ceil(((this.ck.y + g) * this.ao.v) / i));
if (!b) {
j = Math.max(j, 0);
k = Math.min(k, e);
}
l = Math.max(l, 0);
m = Math.min(m, e);
var n = ((j * h) - (this.ck.x * this.ao.v)) / h;
var o = ((l * i) - (this.ck.y * this.ao.u)) / i;
var p = (f * this.ao.v / h) * (this.ao.r / this.cn.width);
var q = new List$1(Tile.$, 0);
var r;
var s;
for (var t = j; t < k; ++t) {
r = t;
s = t;
while (s < 0) {
s = e + s;
}
while (s > e - 1) {
s = (s - e);
}
var _loop_2 = function (u) {
var v = this_2.a8(r, s, u, d);
if (v >= 0) {
q.add(this_2.ay._inner[v]);
this_2.ay.removeAt(v);
}
else {
q.add(((function () {
var $ret = new Tile();
$ret.c = r;
$ret.d = s;
$ret.e = u;
$ret.f = d;
return $ret;
})()));
}
};
var this_2 = this;
for (var u = l; u < m; ++u) {
_loop_2(u);
}
}
this.ap.f = true;
this.cb();
this.ay = q;
var _loop_3 = function (w) {
if (this_3.ay._inner[w].i == null) {
this_3.ay._inner[w].i = this_3.ap.a();
this_3.ay._inner[w].i._opacity = 1;
this_3.an.am(this_3.ay._inner[w].i);
var x = this_3.am(this_3.ay._inner[w]);
if (x != null) {
this_3.ay._inner[w].i.ac = x;
}
else {
var y = null;
var z = ((function () {
var $ret = new Tile();
$ret.d = _this.ay._inner[w].d;
$ret.e = _this.ay._inner[w].e;
$ret.f = _this.ay._inner[w].f;
return $ret;
})());
while (z.f >= 0 && y == null) {
z.d = z.d >> 1;
z.e = z.e >> 1;
z.f = z.f - 1;
y = this_3.am(z);
}
if (y != null) {
var aa = truncate(Math.pow(2, this_3.ay._inner[w].f - z.f));
var ab = intDivide(256, aa);
var ac = ab * (this_3.ay._inner[w].d % aa);
var ad = ab * (this_3.ay._inner[w].e % aa);
this_3.ay._inner[w].h = this_3.ap.a();
this_3.ay._inner[w].h._opacity = 1;
this_3.an.an(this_3.ay._inner[w].h);
x = this_3.an.a(ab, y, ac, ad);
this_3.ay._inner[w].h.ac = x;
}
this_3.an.u(this_3.ay._inner[w]);
}
}
var ae = this_3.ao.r / p;
var af = this_3.ao.p / p;
var ag = (this_3.ay._inner[w].c - j + n) * ae;
var ah = (this_3.ay._inner[w].e - l + o) * af;
this_3.ay._inner[w].i.width = ae + 0.5;
this_3.ay._inner[w].i.height = af + 0.5;
this_3.an.ao(this_3.ay._inner[w].i, ag, ah);
if (this_3.ay._inner[w].h != null) {
this_3.ay._inner[w].h.width = ae + 0.5;
this_3.ay._inner[w].h.height = af + 0.5;
this_3.an.ao(this_3.ay._inner[w].h, ag, ah);
}
};
var this_3 = this;
for (var w = 0; w < this.ay.count; ++w) {
_loop_3(w);
}
this.ap.f = false;
this.an.aj();
};
XamMultiScaleImage.prototype.b5 = function () {
if (this.ao == null || !this.an.f() || this.cn.width == 0 || this.cn.height == 0) {
return;
}
if (this.aw) {
return;
}
this.aw = true;
this.an.s(runOn(this, this.b6));
};
XamMultiScaleImage.prototype.cb = function () {
for (var a = 0; a < this.ay.count; ++a) {
this.an.r(this.ay._inner[a]);
this.bp(this.ay._inner[a]);
if (this.ay._inner[a].i != null) {
this.ap.n(this.ay._inner[a].i);
this.ay._inner[a].i.ac = null;
this.ay._inner[a].i = null;
}
}
};
XamMultiScaleImage.prototype.b4 = function () {
this.ar.i();
};
XamMultiScaleImage.prototype.am = function (a) {
return this.ar.item(a);
};
XamMultiScaleImage.prototype.bo = function (a, b) {
this.ar.item(a, b);
};
Object.defineProperty(XamMultiScaleImage.prototype, "ar", {
get: function () {
return this.aq;
},
set: function (a) {
this.aq = a;
},
enumerable: false,
configurable: true
});
XamMultiScaleImage.prototype.au = function () {
return this.az.count != 0;
};
XamMultiScaleImage.prototype.bt = function () {
var a = true;
if (this.au()) {
a = false;
}
if (!this.an.d()) {
a = false;
}
if (a && !this.as) {
if (this.imageTilesReady != null) {
this.imageTilesReady(this, new EventArgs());
}
}
this.as = a;
};
XamMultiScaleImage.prototype.ca = function (a) {
if (a.h != null) {
a.b = dateNow();
this.az.add(a);
this.an.ap();
}
else {
this.bt();
}
};
XamMultiScaleImage.prototype.bp = function (a) {
if (a.h != null) {
this.ap.n(a.h);
a.h.ac = null;
a.h = null;
for (var b = 0; b < this.az.count; ++b) {
if (this.az._inner[b] == a) {
this.az.removeAt(b);
break;
}
}
if (this.az.count == 0) {
this.an.ar();
}
}
};
XamMultiScaleImage.prototype.br = function () {
var a = dateNow();
var b = 0.5;
for (var c = 0; c < this.az.count;) {
var d = a.getTime() - this.az._inner[c].b.getTime();
var e = d / 1000;
var f = (e) / b;
f = MathUtil.d(f, 0, 1);
this.az._inner[c].h._opacity = 1 - f;
if (f >= 1) {
this.ap.n(this.az._inner[c].h);
this.az._inner[c].h.ac = null;
this.az._inner[c].h = null;
this.az.removeAt(c);
}
else {
++c;
}
this.an.x();
}
if (this.az.count == 0) {
this.an.ar();
}
};
XamMultiScaleImage.prototype.by = function () {
this.a2 = this.a5;
this.ck = this.cm;
this.b5();
};
XamMultiScaleImage.prototype.b0 = function (a) {
var b = a;
this.ag.m(b);
this.an.ae(a);
};
XamMultiScaleImage.prototype.b1 = function (a) {
this.an.ag(a);
};
XamMultiScaleImage.prototype.b2 = function (a) {
this.an.ah(a);
};
XamMultiScaleImage.prototype.b3 = function (a) {
this.an.ai(a);
};
XamMultiScaleImage.prototype.bw = function () {
if (this.imagesChanged != null) {
this.imagesChanged(this, new EventArgs());
}
};
XamMultiScaleImage.prototype.bq = function () {
this.aw = false;
};
XamMultiScaleImage.prototype.bv = function (a) {
if (this.downloadingImage != null) {
this.downloadingImage(this, a);
}
};
XamMultiScaleImage.prototype.bu = function (a) {
if (this.cancellingImage != null) {
this.cancellingImage(this, a);
}
};
Object.defineProperty(XamMultiScaleImage.prototype, "a4", {
get: function () {
return this.a1;
},
enumerable: false,
configurable: true
});
XamMultiScaleImage.prototype.bz = function (a) {
this.a1 = a;
};
Object.defineProperty(XamMultiScaleImage.prototype, "a9", {
get: function () {
return this.ar.h;
},
set: function (a) {
var b = a != this.a9;
if (b) {
this.ar = new LRUCache$2(Tile.$, WriteableBitmap.$, 1, a, new TilePositionComparer());
}
},
enumerable: false,
configurable: true
});
XamMultiScaleImage.$t = markType(XamMultiScaleImage, 'XamMultiScaleImage', Control.$, [INotifyPropertyChanged_$type]);
XamMultiScaleImage.$$p = markDep(DependencyProperty, PropertyMetadata, XamMultiScaleImage, 'bx', ['IsHorizontalTileWrappingEnabled:av:cc', [0, false], 'Referer:bf:cd', [2, null], 'Source:ao:ce', [XamMultiScaleTileSource.$, null], 'SpringsEasingFunction:aj:cf', [IEasingFunction_$type, null], 'UseSprings:ax:ch', [0, false], 'UserAgent:bj:cg', [2, null], 'ViewportOrigin:cm:ci', [Point_$type, { $type: Point_$type, x: 0, y: 0 }], 'ViewportWidth:a5:cj', [1, 1]]);
return XamMultiScaleImage;
}(Control));
export { XamMultiScaleImage };