'use strict';

var graphic = require('../../util/graphic.js');

/**
 * [CAVEAT]: the call order of `ThumbnailView['render']` and other
 *  `ChartView['render']/ComponentView['render']` is not guaranteed.
 */
var ThumbnailBridgeImpl = /** @class */function () {
  function ThumbnailBridgeImpl(thumbnailModel) {
    this._thumbnailModel = thumbnailModel;
  }
  ThumbnailBridgeImpl.prototype.reset = function (api) {
    this._renderVersion = api.getMainProcessVersion();
  };
  ThumbnailBridgeImpl.prototype.renderContent = function (opt) {
    var thumbnailView = opt.api.getViewOfComponentModel(this._thumbnailModel);
    if (!thumbnailView) {
      return;
    }
    opt.group.silent = true;
    thumbnailView.renderContent({
      group: opt.group,
      targetTrans: opt.targetTrans,
      z2Range: graphic.calcZ2Range(opt.group),
      roamType: opt.roamType,
      viewportRect: opt.viewportRect,
      renderVersion: this._renderVersion
    });
  };
  ThumbnailBridgeImpl.prototype.updateWindow = function (targetTrans, api) {
    var thumbnailView = api.getViewOfComponentModel(this._thumbnailModel);
    if (!thumbnailView) {
      return;
    }
    thumbnailView.updateWindow({
      targetTrans: targetTrans,
      renderVersion: this._renderVersion
    });
  };
  return ThumbnailBridgeImpl;
}();

exports.ThumbnailBridgeImpl = ThumbnailBridgeImpl;
