Skip to content

Commit

Permalink
Remove unnecessary private variable. (#36846)
Browse files Browse the repository at this point in the history
  • Loading branch information
processprocess committed Nov 9, 2021
1 parent deee946 commit c21f049
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions extensions/amp-story-panning-media/0.1/amp-story-panning-media.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,6 @@ export class AmpStoryPanningMedia extends AMP.BaseElement {
constructor(element) {
super(element);

/** @private {?Element} */
this.element_ = element;

/** @private {?Element} The element that is transitioned. */
this.ampImgEl_ = null;

Expand Down Expand Up @@ -105,20 +102,18 @@ export class AmpStoryPanningMedia extends AMP.BaseElement {

/** @override */
layoutCallback() {
this.ampImgEl_ = dev().assertElement(
this.element_.querySelector('amp-img')
);
this.ampImgEl_ = dev().assertElement(this.element.querySelector('amp-img'));

this.groupId_ =
this.element_.getAttribute('group-id') ||
this.element.getAttribute('group-id') ||
this.ampImgEl_.getAttribute('src');

this.initializeListeners_();

return whenUpgradedToCustomElement(this.ampImgEl_)
.then(() => this.ampImgEl_.signals().whenSignal(CommonSignals.LOAD_END))
.then(() => {
const imgEl = dev().assertElement(this.element_.querySelector('img'));
const imgEl = dev().assertElement(this.element.querySelector('img'));
// Remove layout="fill" classes so image is not clipped.
imgEl.classList = '';
this.setImageCenteringStyles_();
Expand All @@ -132,8 +127,8 @@ export class AmpStoryPanningMedia extends AMP.BaseElement {
StateProperty.PAGE_SIZE,
() => {
this.elementSize_ = {
width: this.element_./*OK*/ offsetWidth,
height: this.element_./*OK*/ offsetHeight,
width: this.element./*OK*/ offsetWidth,
height: this.element./*OK*/ offsetHeight,
};
this.setImageCenteringStyles_();
this.setAnimateTo_();
Expand Down Expand Up @@ -168,10 +163,10 @@ export class AmpStoryPanningMedia extends AMP.BaseElement {

/** @private */
setAnimateTo_() {
const x = parseFloat(this.element_.getAttribute('data-x') || 0);
const y = parseFloat(this.element_.getAttribute('data-y') || 0);
const zoom = parseFloat(this.element_.getAttribute('data-zoom') || 1);
const lockBounds = this.element_.hasAttribute('lock-bounds');
const x = parseFloat(this.element.getAttribute('data-x') || 0);
const y = parseFloat(this.element.getAttribute('data-y') || 0);
const zoom = parseFloat(this.element.getAttribute('data-zoom') || 1);
const lockBounds = this.element.hasAttribute('lock-bounds');

if (lockBounds) {
// Zoom must be set to calculate maxBounds.
Expand Down Expand Up @@ -278,7 +273,7 @@ export class AmpStoryPanningMedia extends AMP.BaseElement {
* @private
*/
setImageCenteringStyles_() {
const imgEl = this.element_.querySelector('img');
const imgEl = this.element.querySelector('img');
if (!imgEl) {
return;
}
Expand Down

0 comments on commit c21f049

Please sign in to comment.