You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched and referenced existing issues, feature requests and discussions
I am filing a FEATURE request.
Description
When I zoom or pan the canvas, I notice that the smoothness differs between selecting a single object, no objects, or all objects. This is quite strange, so I investigated the issue.
setViewportTransform(vpt: TMat2D){super.setViewportTransform(vpt);constactiveObject=this._activeObject;if(activeObject){-// activeObject.setCoords();+activeObject.oCoords=activeObject.calcOCoords();// as well}}
When selecting or deselecting an element, would it be better to update only oCoords?
When adding elements to the canvas, would it be better to update only oCoords?
_onObjectAdded(obj: FabricObject){if(obj.canvas&&(obj.canvasasStaticCanvas)!==this){log('warn','Canvas is trying to add an object that belongs to a different canvas.\n'+'Resulting to default behavior: removing object from previous canvas and adding to new canvas',);obj.canvas.remove(obj);}obj._set('canvas',this);-// obj.setCoords();+obj.oCoords=obj.calcOCoords();// as wellthis.fire('object:added',{target: obj});obj.fire('added',{target: this});}
When the position of an element changes, it calls setCoords to update the cache. Would it be better to use InteractiveFabricObject.prototype.setCoords.call(target) instead?
_enterGroup(object: FabricObject,removeParentTransform?: boolean){
...
-// this._shouldSetNestedCoords() && object.setCoords();+this._shouldSetNestedCoords()&&InteractiveFabricObject.prototype.setCoords.call(object);// as well
...
}_exitGroup(object: FabricObject,removeParentTransform?: boolean){object._set('group',undefined);if(!removeParentTransform){applyTransformToObject(object,multiplyTransformMatrices(this.calcTransformMatrix(),object.calcTransformMatrix(),),);-// object.setCoords();+InteractiveFabricObject.prototype.setCoords.call(object);// as well
...
}
When a shape changes, can it be made more precise?
Because I have customized a layout manager (automatic layout), every time setCoords is called, it updates its own position and the positions of its child elements (based on calculated positions). As a result, the setCoords method in my custom group involves a significant amount of computation, which I hope to minimize as much as possible.
Additional Context
No response
The text was updated successfully, but these errors were encountered:
@tetap
They use getCoords to obtain the absolute position. Although it utilizes its own aCoords cache, it will still perform an additional calculation if it's within a group.
What you're asking is not the same question as what I'm addressing in this article.
CheckList
Description
When I zoom or pan the canvas, I notice that the smoothness differs between selecting a single object, no objects, or all objects. This is quite strange, so I investigated the issue.
When selecting or deselecting an element, would it be better to update only oCoords?
When adding elements to the canvas, would it be better to update only oCoords?
When the position of an element changes, it calls setCoords to update the cache. Would it be better to use InteractiveFabricObject.prototype.setCoords.call(target) instead?
When a shape changes, can it be made more precise?
Current State
Because I have customized a layout manager (automatic layout), every time setCoords is called, it updates its own position and the positions of its child elements (based on calculated positions). As a result, the setCoords method in my custom group involves a significant amount of computation, which I hope to minimize as much as possible.
Additional Context
No response
The text was updated successfully, but these errors were encountered: