Skip to content

centerContent

Introduction

centerContent Display the content in the center of the view. If the content size exceeds the view, the content will be proportionally reduced and centered in the view.

Arguments

  • {object} options
    • {Data} options.data Optionally, calculate new content data for centered dimensions.

Returns

N/A

Usage

js
import { iDraw } from 'idraw';

const app = document.querySelector('#app');
const options = {
  width: 600,
  height: 400,
  devicePixelRatio: 2
};
const idraw = new iDraw(app, options);
idraw.setData({
  element: [
    /* ... */
  ]
});

idraw.centerContent();

Example

More Demo