IMPORTANT: This version of Sitefinity CMS is out of support and the respective product documentation is no longer maintained and can be outdated. Use the version selector to view a supported product version.
The aspect ratio selection enables you to display and retrieve selected width, height, and aspect ratio.
The settings you select are kept in an object variable that has width, height, and aspectRatio properties. The default template renders four options for aspect ratio - Auto, 4x3, 16x9, Custom. When Auto is selected, you can not edit width and height. When 4x3 or 16x9 aspect ratio option is selected, when you edit the width or height, the other field will also change to fit in the selected aspect ratio.
width
height
aspectRatio
You can use the aspect ratio selection in the frontend, as well as in the backend. For example, on a page, as well as in a widget designer.
The sfAspectRatioSelection is a directive with an isolated scope that is defined in a module with the same name: sfAspectRatioSelection. For more information, see Isolating the Scope of a Directive
sfAspectRatioSelection
The sfAspectRatioSelection directive exposes the following attributes:
sf-model
sf-template-url
sf-template-assembly
The following example demonstrates how to add a aspect ratio selection directive in a widget designer's view.
To enable AngularJS to link the sfAspectRatioSelection directive in your custom designer view, you must load the script of the directive and add a dependency to the module. Perform the following:
DesignerView.YourView.json file
JSON
DesignerView.YourView.json
designerview-yourview.js
The code above shows an aspect ratio selection that enables you to select and edit aspect ratio, width and height. The selected values are kept in the aspectRatioModel object.
aspectRatioModel
DesignerView.YourView.cshtml
Back To Top
To submit feedback, please update your cookie settings and allow the usage of Functional cookies.
Your feedback about this content is important