tui.image-editor icon indicating copy to clipboard operation
tui.image-editor copied to clipboard

rotatingPointOffset doesn't work

Open paulolafoudre opened this issue 3 years ago • 3 comments

Describe the bug I am using "tui-image-editor": "^3.11.0" and during the creation of a new tui Instance, i give this as selectionStyle :

Capture d’écran 2021-03-18 à 14 38 31

  • white is good

  • cornerSize is good

  • rotatingPointOffset is ignored (i tried 5, 100, 1000 nothing has changed in the view)

Nothing in particular appears in console prompt.

Desktop:

  • OS: macOS11.2
  • Browser chrome
  • Version 89

Smartphone:

  • Device: iPhone XR
  • OS: iOS14
  • Browser Safari
  • Version 14

paulolafoudre avatar Mar 18 '21 13:03 paulolafoudre

@paulolafoudre Thank you for the report. I'll check the cause and solve it ASAP.

lja1018 avatar Mar 19 '21 07:03 lja1018

I'm also having this issue, does anyone solved it ?

darkcris1 avatar Apr 18 '21 08:04 darkcris1

RotatingPointOffset was removed in fabric.js version 4. Instead, a parameter offsetY was introduced on the controls. This needs to be modified with:

window.fabric.Object.prototype.controls. mtr.offsetY = [offsetValue]

These controls are initialized with default values at deployment of fabric. mtr is the "middle top rotating point"

RotatingPointOffset as config parameter of objects doesn't exist anymore in fabric.

LeakAGeek avatar Aug 05 '22 17:08 LeakAGeek

As a workaround I am using something similar to @LeakAGeek 's solution, but outside from editor (so I can use it as an untouched npm library) and for each individual object separately (my particular use case is superfast image watermarking without the need to upload files and I anyway support one textualwatermark only at the moment):

const imageEditor = new ImageEditor('.tui-image-editor', {
...
imageEditor.loadImageFromFile(file).then(() => {
...
imageEditor._graphics.getObject(id_of_the_obj_i_am_interested_in).controls.mtr.offsetY = -goodRotatingPointOffsetValue;

amarchen avatar Dec 04 '22 22:12 amarchen