The preview and the saved image have different sizes
A photo editor usually shows a smaller canvas than the image it exports. Storing a drag offset as a number of preview pixels is not enough: applying the same number to a larger output moves the photo by a different proportion.
Framvo’s shared composition function takes the reference size, output size, original image dimensions, scale, offsets, and rotation. It calculates the values needed to draw the photo at the output size.
Keep the math separate from the renderer
The coordinate function is plain TypeScript. The web client draws with Canvas, while the mobile result is captured from native views. Putting the model in a shared package lets each platform keep its own drawing and export tools.
For a proportional preview, an offset is multiplied by the ratio between output and reference dimensions. A horizontal shift of 20 pixels on a 300-pixel preview becomes 80 pixels on a 1,200-pixel output. Scale and the rotation pivot need the same consistent frame of reference.
The assumptions still matter
Framvo’s composition model uses the horizontal size ratio for the overall photo scale. That assumes the preview and output represent the same proportions. A differently cropped viewport needs an explicit mapping; the shared function cannot infer one.
I would check an editor at several output sizes, with portrait and landscape photos, off-centre placement, and rotation. Frame and background campaigns also need different layer orders. Testing only a centred, unrotated photo leaves a lot of the real behavior unchecked.