Skip to content

Commit

Permalink
fix(ViewService): move zIndex layer updates into _updateViewport
Browse files Browse the repository at this point in the history
  • Loading branch information
speigg committed Apr 27, 2017
1 parent af853c0 commit bc842b2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions dist/argon.core.js
Original file line number Diff line number Diff line change
Expand Up @@ -18222,12 +18222,9 @@ $__System.register('1', ['2', '3', '3d', '4', '9', '10', 'a', '1d', '35', '2d',
}
}
this._layers = layers;
var zIndex = -layers.length;
for (var _b = 0, layers_1 = layers; _b < layers_1.length; _b++) {
var l = layers_1[_b];
this.element.appendChild(l.source);
l.source.style.zIndex = '' + zIndex;
zIndex++;
}
};
Object.defineProperty(ViewService.prototype, "layers", {
Expand Down Expand Up @@ -18323,6 +18320,7 @@ $__System.register('1', ['2', '3', '3d', '4', '9', '10', 'a', '1d', '35', '2d',
var viewportJSON = JSON.stringify(viewport);
if (this.layers && this.autoStyleLayerElements) {
requestAnimationFrame(function () {
var zIndex = -_this._layers.length;
for (var _i = 0, _a = _this._layers; _i < _a.length; _i++) {
var layer = _a[_i];
var layerStyle = layer.source.style;
Expand All @@ -18331,6 +18329,8 @@ $__System.register('1', ['2', '3', '3d', '4', '9', '10', 'a', '1d', '35', '2d',
layerStyle.bottom = viewport.y + 'px';
layerStyle.width = viewport.width + 'px';
layerStyle.height = viewport.height + 'px';
layerStyle.zIndex = '' + zIndex;
zIndex++;
}
});
}
Expand Down
6 changes: 3 additions & 3 deletions dist/argon.js
Original file line number Diff line number Diff line change
Expand Up @@ -23802,12 +23802,9 @@ $__System.register('1', ['2', '3', '3d', '4', '9', '10', 'a', '1d', '35', '2d',
}
}
this._layers = layers;
var zIndex = -layers.length;
for (var _b = 0, layers_1 = layers; _b < layers_1.length; _b++) {
var l = layers_1[_b];
this.element.appendChild(l.source);
l.source.style.zIndex = '' + zIndex;
zIndex++;
}
};
Object.defineProperty(ViewService.prototype, "layers", {
Expand Down Expand Up @@ -23903,6 +23900,7 @@ $__System.register('1', ['2', '3', '3d', '4', '9', '10', 'a', '1d', '35', '2d',
var viewportJSON = JSON.stringify(viewport);
if (this.layers && this.autoStyleLayerElements) {
requestAnimationFrame(function () {
var zIndex = -_this._layers.length;
for (var _i = 0, _a = _this._layers; _i < _a.length; _i++) {
var layer = _a[_i];
var layerStyle = layer.source.style;
Expand All @@ -23911,6 +23909,8 @@ $__System.register('1', ['2', '3', '3d', '4', '9', '10', 'a', '1d', '35', '2d',
layerStyle.bottom = viewport.y + 'px';
layerStyle.width = viewport.width + 'px';
layerStyle.height = viewport.height + 'px';
layerStyle.zIndex = '' + zIndex;
zIndex++;
}
});
}
Expand Down
2 changes: 1 addition & 1 deletion dist/argon.min.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,8 @@ export class ViewService {
}
}
this._layers = layers;
let zIndex = -layers.length;
for (const l of layers) {
this.element.appendChild(l.source);
l.source.style.zIndex = '' + zIndex;
zIndex++;
}
}

Expand Down Expand Up @@ -343,13 +340,16 @@ export class ViewService {

if (this.layers && this.autoStyleLayerElements) {
requestAnimationFrame(() => {
let zIndex = -this._layers.length;
for (const layer of this._layers) {
const layerStyle = layer.source.style;
layerStyle.position = 'absolute';
layerStyle.left = viewport.x + 'px';
layerStyle.bottom = viewport.y + 'px';
layerStyle.width = viewport.width + 'px';
layerStyle.height = viewport.height + 'px';
layerStyle.zIndex = '' + zIndex;
zIndex++;
}
})
}
Expand Down

0 comments on commit bc842b2

Please sign in to comment.