ResolutionPolicy Class
Module: _decorator Parent Module: cc
cc.ResolutionPolicy class is the root strategy class of scale strategy, its main task is to maintain the compatibility with Cocos2d-x
Index
Properties
- EXACT_FIT- NumberThe entire application is visible in the specified area without trying to preserve the original aspect ratio.
 Distortion can occur, and the application may appear stretched or compressed.
- NO_BORDER- NumberThe entire application fills the specified area, without distortion but possibly with some cropping,
 while maintaining the original aspect ratio of the application.
- SHOW_ALL- NumberThe entire application is visible in the specified area without distortion while maintaining the original
 aspect ratio of the application. Borders can appear on two sides of the application.
- FIXED_HEIGHT- NumberThe application takes the height of the design resolution size and modifies the width of the internal
 canvas so that it fits the aspect ratio of the device
 no distortion will occur however you must make sure your application works on different
 aspect ratios
- FIXED_WIDTH- NumberThe application takes the width of the design resolution size and modifies the height of the internal
 canvas so that it fits the aspect ratio of the device
 no distortion will occur however you must make sure your application works on different
 aspect ratios
- UNKNOWN- NumberUnknow policy
Methods
- constructor
- preApplyManipulation before applying the resolution policy
- applyFunction to apply this resolution policy The return value is {scale: [scaleX, scaleY], viewport: {cc.Rect}}, The target view can then apply these value to itself, it's preferred not to modify directly its private variables
- postApplyManipulation after appyling the strategy
- setContainerStrategySetup the container's scale strategy
- setContentStrategySetup the content's scale strategy
Details
Properties
EXACT_FIT
The entire application is visible in the specified area without trying to preserve the original aspect ratio.
Distortion can occur, and the application may appear stretched or compressed.
| meta | description | 
|---|---|
| Type | Number | 
| Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/platform/CCView.js:1441 | 
NO_BORDER
The entire application fills the specified area, without distortion but possibly with some cropping,
while maintaining the original aspect ratio of the application.
| meta | description | 
|---|---|
| Type | Number | 
| Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/platform/CCView.js:1450 | 
SHOW_ALL
The entire application is visible in the specified area without distortion while maintaining the original
aspect ratio of the application. Borders can appear on two sides of the application.
| meta | description | 
|---|---|
| Type | Number | 
| Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/platform/CCView.js:1459 | 
FIXED_HEIGHT
The application takes the height of the design resolution size and modifies the width of the internal
canvas so that it fits the aspect ratio of the device
no distortion will occur however you must make sure your application works on different
aspect ratios
| meta | description | 
|---|---|
| Type | Number | 
| Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/platform/CCView.js:1468 | 
FIXED_WIDTH
The application takes the width of the design resolution size and modifies the height of the internal
canvas so that it fits the aspect ratio of the device
no distortion will occur however you must make sure your application works on different
aspect ratios
| meta | description | 
|---|---|
| Type | Number | 
| Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/platform/CCView.js:1479 | 
UNKNOWN
Unknow policy
| meta | description | 
|---|---|
| Type | Number | 
| Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/platform/CCView.js:1490 | 
Methods
constructor
| meta | description | 
|---|---|
| Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/platform/CCView.js:1363 | 
Parameters
- containerStgContainerStrategy The container strategy
- contentStgContentStrategy The content strategy
preApply
Manipulation before applying the resolution policy
| meta | description | 
|---|---|
| Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/platform/CCView.js:1382 | 
Parameters
- viewView The target view
apply
Function to apply this resolution policy The return value is {scale: [scaleX, scaleY], viewport: {cc.Rect}}, The target view can then apply these value to itself, it's preferred not to modify directly its private variables
| meta | description | 
|---|---|
| Returns | Object | 
| Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/platform/CCView.js:1392 | 
Parameters
postApply
Manipulation after appyling the strategy
| meta | description | 
|---|---|
| Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/platform/CCView.js:1406 | 
Parameters
- viewView The target view
setContainerStrategy
Setup the container's scale strategy
| meta | description | 
|---|---|
| Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/platform/CCView.js:1416 | 
Parameters
- containerStgContainerStrategy
setContentStrategy
Setup the content's scale strategy
| meta | description | 
|---|---|
| Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/platform/CCView.js:1426 | 
Parameters
- contentStgContentStrategy
