Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IOS clipPath] When adding an object's clippath to canvas and drag it several times, get "Total canvas memory use exceed the maximum limit" error. However, if do not add the object's clippath to the canvas, work normally. #5551

Closed
SooChang-Lee opened this issue Mar 4, 2019 · 7 comments
Labels
stale Issue marked as stale by the stale bot

Comments

@SooChang-Lee
Copy link

SooChang-Lee commented Mar 4, 2019

Version

2.4.6~2.7.0

Test Case

Getting memory error
http://etc.soochang.pe.kr/iphone_test_clippath_added.html
Working fine
http://etc.soochang.pe.kr/iphone_test.html

Information about environment

Nodejs or browser?
browser

Which browsers?
iOS(12.1.4) safari, chrome, firefox(iPhone 6, iPhone X) - error
Android chrome(Galaxy note fe, Galaxy s6). - fine

The object's clippath works whether it is added to the canvas or not. However, if the object's clippath is added to the canvas on the iPhone, dragging a few times will cause a memory error.

Actual Behavior

When adding an object's clippath to canvas and drag it several times, get "Total canvas memory use exceed the maximum limit" error. However, if do not add the object's clippath to the canvas, work normally.

2019-03-04 12 21 02

img_518cec1a9bef-1

@anthify
Copy link
Contributor

anthify commented Mar 5, 2019

I believe this maybe connected to this issue.

Try adding this to your code before instantiating your canvas. (warning: using some es6 features).

fabric.Canvas.prototype._toObjectMethod = function _toObjectMethod(
  methodName,
  propertiesToInclude
) {
  const { clipPath } = this;
  const data = {
    version: fabric.version,
    objects: this._toObjects(methodName, propertiesToInclude)
  };

  if (clipPath) {
    data.clipPath = clipPath;
  }

  fabric.util.object.extend(
    data,
    this.__serializeBgOverlay(methodName, propertiesToInclude)
  );

  fabric.util.populateWithProperties(this, data, propertiesToInclude);

  return data;
};

@SooChang-Lee
Copy link
Author

SooChang-Lee commented Mar 5, 2019

I have applied your code but still have a memory error on the iPhone.

I have not been able to release the app for iPhone because this issue is not resolved.
There is no problem with Android and PC browsers.

Could you fix a memory error when using clippath on the iPhone?

@asturur Please take a look at this issue

@SooChang-Lee
Copy link
Author

@asturur @kangax Please check this issue...

@asturur
Copy link
Member

asturur commented Mar 7, 2019

have lot of emails, getting rid of the one liners first to make some breathing space for me.

Meanwhile can you try to disable retina on your canvas? Just to try.

when creating the canvas pass 'enableRetinaScaling: false' in the options object.

@SooChang-Lee
Copy link
Author

SooChang-Lee commented Mar 7, 2019

@asturur Thank you for your effort.

Changing enableRetinaScaling to false still causes the same problem.
(Total canvas memory use exceed the maximum limit 224MB)

There is a problem with using a small image. Take a look at the example url.

The problem occurs when clippath is added to the canvas.

There is no problem in the pc browser and the android browser.

I hope it has been resolved.

@stale
Copy link

stale bot commented Jan 26, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale Issue marked as stale by the stale bot label Jan 26, 2020
@stale stale bot closed this as completed Feb 2, 2020
@ghost
Copy link

ghost commented Mar 21, 2022

@asturur @kangax Have you fix this issue?

it happen to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Issue marked as stale by the stale bot
Projects
None yet
Development

No branches or pull requests

3 participants