diff --git a/src/GraphQL/AssetType/AssetType.php b/src/GraphQL/AssetType/AssetType.php index fd92b4e38..faef1ae2d 100644 --- a/src/GraphQL/AssetType/AssetType.php +++ b/src/GraphQL/AssetType/AssetType.php @@ -71,6 +71,13 @@ public function build(&$config) 'height' => Type::int(), ], ]); + $focalPointsType = new ObjectType([ + 'name' => 'focalPoints', + 'fields' => [ + 'x' => Type::float(), + 'y' => Type::float(), + ], + ]); // see https://developer.mozilla.org/en-US/docs/Learn/HTML/Multimedia_and_embedding/Responsive_images#Resolution_switching_Same_size_different_resolutions $resolutionsType = Type::listOf(new ObjectType([ @@ -126,6 +133,10 @@ public function build(&$config) 'type' => Type::float(), 'resolve' => [$resolver, 'resolveDuration'], ], + 'focalPoints' => [ + 'type' => $focalPointsType, + 'resolve' => [$resolver, 'resolveFocalPoints'], + ], 'srcset' => [ 'type' => Type::listOf(new ObjectType([ 'name' => 'srcset', diff --git a/src/GraphQL/Resolver/AssetType.php b/src/GraphQL/Resolver/AssetType.php index cca829f0a..a7b94cfce 100644 --- a/src/GraphQL/Resolver/AssetType.php +++ b/src/GraphQL/Resolver/AssetType.php @@ -396,6 +396,34 @@ public function resolveVersion($value = null, $args = [], $context = [], ?Resolv return null; } + /** + * @return array{x: float, y: float}|null + * + * @throws Exception + */ + public function resolveFocalPoints(?ElementDescriptor $value = null, array $context = []): ?array + { + $asset = $this->getAssetFromValue($value, $context); + + if (!$asset instanceof Asset\Image) { + return null; + } + + $x = $asset->getCustomSetting('focalPointX'); + $y = $asset->getCustomSetting('focalPointY'); + + // returning an array of nulls would make the default field resolver resolve every + // subfield on its own, so the response would contain {x: null, y: null} instead of null + if ($x === null || $y === null) { + return null; + } + + return [ + 'x' => (float) $x, + 'y' => (float) $y, + ]; + } + /** * @throws Exception */ diff --git a/src/Resources/public/studio/build/479c1d93-27f5-45cc-bd90-1a42d415aaf1/entrypoints.json b/src/Resources/public/studio/build/479c1d93-27f5-45cc-bd90-1a42d415aaf1/entrypoints.json new file mode 100644 index 000000000..bc4636ebf --- /dev/null +++ b/src/Resources/public/studio/build/479c1d93-27f5-45cc-bd90-1a42d415aaf1/entrypoints.json @@ -0,0 +1,28 @@ +{ + "entrypoints": { + "main": { + "js": [ + "/bundles/pimcoredatahub/studio/build/479c1d93-27f5-45cc-bd90-1a42d415aaf1/static/js/109.62a4c31b.js", + "/bundles/pimcoredatahub/studio/build/479c1d93-27f5-45cc-bd90-1a42d415aaf1/static/js/main.9c3ad8a2.js" + ], + "css": [] + }, + "pimcore_datahub_bundle": { + "js": [ + "/bundles/pimcoredatahub/studio/build/479c1d93-27f5-45cc-bd90-1a42d415aaf1/static/js/async/499.5c3b9b56.js", + "/bundles/pimcoredatahub/studio/build/479c1d93-27f5-45cc-bd90-1a42d415aaf1/static/js/async/346.60211bf9.js", + "/bundles/pimcoredatahub/studio/build/479c1d93-27f5-45cc-bd90-1a42d415aaf1/static/js/async/840.b584be96.js", + "/bundles/pimcoredatahub/studio/build/479c1d93-27f5-45cc-bd90-1a42d415aaf1/static/js/async/__federation_expose_default_export.0f3356b6.js", + "/bundles/pimcoredatahub/studio/build/479c1d93-27f5-45cc-bd90-1a42d415aaf1/static/js/async/__federation_expose_plugins.61959a04.js", + "/bundles/pimcoredatahub/studio/build/479c1d93-27f5-45cc-bd90-1a42d415aaf1/static/js/remoteEntry.js" + ], + "css": [] + }, + "exposeRemote": { + "js": [ + "/bundles/pimcoredatahub/studio/build/479c1d93-27f5-45cc-bd90-1a42d415aaf1/exposeRemote.js" + ], + "css": [] + } + } +} \ No newline at end of file diff --git a/src/Resources/public/studio/build/e6891a04-71b8-4c95-aa14-55f166a8139b/exposeRemote.js b/src/Resources/public/studio/build/479c1d93-27f5-45cc-bd90-1a42d415aaf1/exposeRemote.js similarity index 85% rename from src/Resources/public/studio/build/e6891a04-71b8-4c95-aa14-55f166a8139b/exposeRemote.js rename to src/Resources/public/studio/build/479c1d93-27f5-45cc-bd90-1a42d415aaf1/exposeRemote.js index b9326a6d6..f6633def0 100644 --- a/src/Resources/public/studio/build/e6891a04-71b8-4c95-aa14-55f166a8139b/exposeRemote.js +++ b/src/Resources/public/studio/build/479c1d93-27f5-45cc-bd90-1a42d415aaf1/exposeRemote.js @@ -7,7 +7,7 @@ window.alternativePluginExportPaths = {} } - window.pluginRemotes.pimcore_datahub_bundle = "/bundles/pimcoredatahub/studio/build/e6891a04-71b8-4c95-aa14-55f166a8139b/static/js/remoteEntry.js" + window.pluginRemotes.pimcore_datahub_bundle = "/bundles/pimcoredatahub/studio/build/479c1d93-27f5-45cc-bd90-1a42d415aaf1/static/js/remoteEntry.js" window.alternativePluginExportPaths.pimcore_datahub_bundle = "/plugins" \ No newline at end of file diff --git a/src/Resources/public/studio/build/e6891a04-71b8-4c95-aa14-55f166a8139b/main.html b/src/Resources/public/studio/build/479c1d93-27f5-45cc-bd90-1a42d415aaf1/main.html similarity index 71% rename from src/Resources/public/studio/build/e6891a04-71b8-4c95-aa14-55f166a8139b/main.html rename to src/Resources/public/studio/build/479c1d93-27f5-45cc-bd90-1a42d415aaf1/main.html index 3d82ef4f0..956c10704 100644 --- a/src/Resources/public/studio/build/e6891a04-71b8-4c95-aa14-55f166a8139b/main.html +++ b/src/Resources/public/studio/build/479c1d93-27f5-45cc-bd90-1a42d415aaf1/main.html @@ -1 +1 @@ -