Menu

#469 Test sizing remote viewport to aspect ratio of minimal client, but pixel resolution of that aspect ratio viewed in the maximal client to address enlargement blur.

closed
nobody
None
2023-11-12
2023-11-12
Anonymous
No

Originally created by: 00000o1

Related

Tickets: #465

Discussion

  • Anonymous

    Anonymous - 2023-11-12

    Originally posted by: 00000o1

    So this is what we have already, pre this change, but we do the scale up on the clients, which creates blur, by scaling up on the server we can reduce blur but we need to be considerate of edge cases regarding viewports that are intended to contain mobile versions of sites but end up too large to do so:

    function findMinDimensions(viewports) {
      let minWidth = Infinity;
      let minHeight = Infinity;
    
      viewports.forEach(vp => {
        if (vp.width < minWidth) minWidth = vp.width;
        if (vp.height < minHeight) minHeight = vp.height;
      });
    
      return { minWidth, minHeight };
    }
    
    function findMaxDimensions(viewports) {
      let maxWidth = 0;
      let maxHeight = 0;
    
      viewports.forEach(vp => {
        if (vp.width > maxWidth) maxWidth = vp.width;
        if (vp.height > maxHeight) maxHeight = vp.height;
      });
    
      return { maxWidth, maxHeight };
    }
    
    function calculateScaledDimensions(minDims, maxDims) {
      // Implement scaling logic here, considering the cap
      const scaleRatio = Math.min(maxDims.maxWidth / minDims.minWidth, maxDims.maxHeight / minDims.minHeight);
      const scaledWidth = minDims.minWidth * scaleRatio;
      const scaledHeight = minDims.minHeight * scaleRatio;
    
      // Apply cap logic here if needed
    
      return { scaledWidth, scaledHeight };
    }
    
    // Example usage
    const viewports = [{ width: 300, height: 500, mobile: true }, /* other viewports */ ];
    const minDims = findMinDimensions(viewports);
    const maxDims = findMaxDimensions(viewports);
    const scaledDims = calculateScaledDimensions(minDims, maxDims);
    
    console.log(scaledDims); // Output the scaled dimensions
    
     
  • Anonymous

    Anonymous - 2023-11-12

    Originally posted by: 00000o1

    This does improve blur on larger screens when mobile clients are connected. Want to look at doing screencast maxWidth and maxHeight as a possible way to set device pixels rather than css pixels that are set with device metrics override.

    If successful that other method would not involve altering device metrics at all regarding scaling up the minimally agreed viewport, but would involve scaling up the screencast max dimensions, which seemingly correspond to device pixels, tho I'm not sure!

     
  • Anonymous

    Anonymous - 2023-11-12

    Ticket changed by: 00000o1

    • status: open --> closed
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.