Opened 9 years ago

Closed 6 years ago

#11436 closed enhancement (fixed)

[patch][CCLA]svg - small change in behavior for openBatch and closeBatch

Reported by: ben hockey Owned by: Patrick Ruzand
Priority: high Milestone: 1.9
Component: DojoX GFX Version: 1.5.0b2
Keywords: Cc: Eugene Lazutkin
Blocked By: Blocking:

Description

this is related to some changes made as part of #9948

what do you think about making a change to the batching so that if you call openBatch a number of times, the extracted contents aren't placed back in the document until a matching number of closeBatch calls are made? currently, the first call to closeBatch will put the contents back in the document. my suggestion is something like this:

		_init: function(){
			gs.Container._init.call(this);
			this._batch = 0;
		},
		openBatch: function() {
			// summary: starts a new batch, subsequent new child shapes will be held in
			//	the batch instead of appending to the container directly
			this.fragment = _createFragment();
			this._batch++;
		},
		closeBatch: function() {
			// summary: submits the current batch, append all pending child shapes to DOM
			this._batch = this._batch > 0 ? this._batch-- : 0;
			if (this.fragment && !this._batch) {
				this.rawNode.appendChild(this.fragment);
				delete this.fragment;
			}
		},

currently code like this pseudo-code won't be as optimized as it could be:

    changeSomething: function () {
        this.surface.openBatch();
            if(someCondition){
                this.changeAnother();
            }
            // update stuff that doesn't depend on someCondition
        this.surface.closeBatch();
    },
    changeAnother: function () {
        this.surface.openBatch();
        // update some other stuff
        this.surface.closeBatch();
    }

the batch is closed after the call to this.changeAnother() and the rest of the updates in changeSomething aren't "batched".

Attachments (1)

11436.patch (8.1 KB) - added by Patrick Ruzand 6 years ago.
patch by pruzand (IBM, CCLA)

Download all attachments as: .zip

Change History (9)

comment:1 Changed 9 years ago by Eugene Lazutkin

Milestone: tbd1.6

Yes, we definitely need this functionality.

comment:2 Changed 9 years ago by Eugene Lazutkin

Status: newassigned

comment:3 Changed 8 years ago by Eugene Lazutkin

Milestone: 1.61.7

comment:4 Changed 8 years ago by Chris Mitchell

Milestone: 1.71.8

comment:5 Changed 7 years ago by Colin Snover

Milestone: 1.82.0

1.8 is frozen. Move all enhancements to next release. If you need an exemption from the freeze for this ticket, contact me immediately.

comment:6 Changed 6 years ago by Patrick Ruzand

Milestone: 2.01.9
Owner: changed from Eugene Lazutkin to Patrick Ruzand

Changed 6 years ago by Patrick Ruzand

Attachment: 11436.patch added

patch by pruzand (IBM, CCLA)

comment:7 Changed 6 years ago by Patrick Ruzand

Summary: svg - small change in behavior for openBatch and closeBatch[patch][CCLA]svg - small change in behavior for openBatch and closeBatch

comment:8 Changed 6 years ago by Patrick Ruzand

Resolution: fixed
Status: assignedclosed

In [30747]:

improves batch implementation to support nested openBatch calls. fixes #11436 !strict

Note: See TracTickets for help on using tickets.