{ "@context":[ "https://www.w3.org/ns/activitystreams", {"Hashtag":"as:Hashtag","sensitive":"as:sensitive"}, {"toot":"http://joinmastodon.org/ns#","focalPoint":"toot:focalPoint"} ], "published":"2025-11-06T16:14:30.492Z", "attributedTo":"https://epiktistes.com/actors/toddsundsted", "inReplyTo":"https://epiktistes.com/objects/0TxHnMksF5I", "replies":"https://epiktistes.com/objects/8Om8QWJvTeE/replies", "to":["https://www.w3.org/ns/activitystreams#Public","https://epiktistes.com/actors/toddsundsted"], "cc":["https://epiktistes.com/actors/toddsundsted/followers"], "content":"
I ended up with a solution that exaggerates the focal point offset from center to try to get more of the image around the focal point inside the container:
def normalized_focal_point\n return nil unless has_focal_point?\n x, y = focal_point.not_nil!\n norm_x = x / 2 + 0.5 # normalized x = x / 2 + 0.5\n norm_y = -y / 2 + 0.5 # normalized y = -y / 2 + 0.5 (y inverted)\n # push the focal point toward the edges so that more of the focused image is in view\n {\n exaggerate(norm_x),\n exaggerate(norm_y)\n }\nend\n\nprivate def exaggerate(value, strength = 0.75)\n centered = value - 0.5\n exaggerated = centered.sign * (centered.abs ** strength)\n (exaggerated + 0.5).clamp(0.0, 1.0)\nendReading up on object-position and its use for focal point support in Mastodon and looking at examples in practice it doesn’t seem like the existing implemented approach works well (link). I'm open to better ways to do this, and I welcome course correction if I'm heading in the wrong direction.
I ended up with a solution that exaggerates the focal point offset from center to try to get more of the image around the focal point inside the container:
def normalized_focal_point\n return nil unless has_focal_point?\n x, y = focal_point.not_nil!\n norm_x = x / 2 + 0.5 # normalized x = x / 2 + 0.5\n norm_y = -y / 2 + 0.5 # normalized y = -y / 2 + 0.5 (y inverted)\n # push the focal point toward the edges so that more of the focused image is in view\n {\n exaggerate(norm_x),\n exaggerate(norm_y)\n }\nend\n\nprivate def exaggerate(value, strength = 0.75)\n centered = value - 0.5\n exaggerated = centered.sign * (centered.abs ** strength)\n (exaggerated + 0.5).clamp(0.0, 1.0)\nendReading up on object-position and its use for focal point support in Mastodon and looking at examples in practice it doesn’t seem like the existing implemented approach works well (link). I'm open to better ways to do this, and I welcome course correction if I'm heading in the wrong direction.