DEV Community

Ramin
Ramin

Posted on

Pikaso v2.6 released

Pikaso v2.6 was released. The release contains a number of bug fixes and new features.

Introducing Background Size

From v2.6.0, both editor.loadFromUrl and editor.loadFromFile accept a second parameter with this interface

interface BackgroundOptions {
  size: 'auto' | 'resize' | 'cover' | 'contain' | 'stretch'
  x: number
  y: number
}
Enter fullscreen mode Exit fullscreen mode

The size field describes how a background image should be loaded in the canvas. The functionality is the same as the CSS feature background-size.

editor.loadFromUrl('<url>') // resizes canvas to to file's size by default

editor.loadFromUrl('<url>', {
  size: 'cover'
})

editor.loadFromFile('<File>', {
  size: 'stretch'
})
Enter fullscreen mode Exit fullscreen mode

Improve Label Shape

Labels can now be resized from different perspectives.
The following configuration should be followed to enable resizing from different aspects:
keepScale will be accessible as of v2.6.0 and by setting that to false, the default scaling behavior will be disabled.
Also, all options for Konva.Transformer are available through transformer

editor.shapes.label.insert({
    container: {/* config */},
    tag: {/* config */},
    text: {/* config */},
    config: {
      keepScale: false|true, // By setting keepScale to false, the default scaling behavior will be disabled
      transformer: {
        keepRatio: true, // keepRatio set to true to maintain scaling when scaling from corners
        enabledAnchors: ['middle-left', 'middle-right', 'bottom-right'] // Here are all the options available https://konvajs.org/api/Konva.Transformer.html#enabledAnchors__anchor
      }
    }
  })
Enter fullscreen mode Exit fullscreen mode

Improve Export/Import

zIndex export/import is now supported.

Top comments (0)