src/internal/drawCompositeImage.js
function syncViewports (layers, activeLayer) {
  // If we intend to keep the viewport's scale, translation and rotation in sync,
  // loop through the layers
  layers.forEach((layer) => {
    // Don't do anything to the active layer
    // Don't do anything if this layer has no viewport
    if (layer === activeLayer ||
        !layer.viewport ||
        !activeLayer.viewport) {
      return;
    }

    if (!layer.syncProps) {
      updateLayerSyncProps(layer);
    }

    const viewportRatio = getViewportRatio(activeLayer, layer);

    // Update the layer's translation and scale to keep them in sync with the first image
    // based on the ratios between the images
    layer.viewport.scale = activeLayer.viewport.scale * viewportRatio;
    layer.viewport.rotation = activeLayer.viewport.rotation;
    layer.viewport.translation = {
      x: (activeLayer.viewport.translation.x / viewportRatio),
      y: (activeLayer.viewport.translation.y / viewportRatio)
    };
    layer.viewport.hflip = activeLayer.viewport.hflip;
    layer.viewport.vflip = activeLayer.viewport.vflip;
  });
}
function syncViewports (layers, activeLayer) {
  // If we intend to keep the viewport's scale, translation and rotation in sync,
  // loop through the layers
  layers.forEach((layer) => {
    // Don't do anything to the active layer
    // Don't do anything if this layer has no viewport
    if (layer === activeLayer ||
        !layer.viewport ||
        !activeLayer.viewport) {
      return;
    }

    if (!layer.syncProps) {
      updateLayerSyncProps(layer);
    }

    const viewportRatio = getViewportRatio(activeLayer, layer);

    // Update the layer's translation and scale to keep them in sync with the first image
    // based on the ratios between the images
    layer.viewport.scale = activeLayer.viewport.scale * viewportRatio;
    layer.viewport.rotation = activeLayer.viewport.rotation;
    layer.viewport.translation = {
      x: (activeLayer.viewport.translation.x / viewportRatio),
      y: (activeLayer.viewport.translation.y / viewportRatio)
    };
    layer.viewport.hflip = activeLayer.viewport.hflip;
    layer.viewport.vflip = activeLayer.viewport.vflip;
  });
}
function syncViewports ( layers , activeLayer ) { // If we intend to keep the viewport's scale, translation and rotation in sync, // loop through the layers layers . forEach ( ( layer ) => { // Don't do anything to the active layer // Don't do anything if this layer has no viewport if ( layer === activeLayer || ! layer . viewport || ! activeLayer . viewport ) { return ; } if ( ! layer . syncProps ) { updateLayerSyncProps ( layer ) ; } const viewportRatio = getViewportRatio ( activeLayer , layer ) ; // Update the layer's translation and scale to keep them in sync with the first image // based on the ratios between the images layer . viewport . scale = activeLayer . viewport . scale * viewportRatio ; layer . viewport . rotation = activeLayer . viewport . rotation ; layer . viewport . translation = { x : ( activeLayer . viewport . translation . x / viewportRatio ) , y : ( activeLayer . viewport . translation . y / viewportRatio ) } ; layer . viewport . hflip = activeLayer . viewport . hflip ; layer . viewport . vflip = activeLayer . viewport . vflip ; } ) ; }
Sync all viewports based on active layer's viewport
Sync all viewports based on active layer s viewport