W3C home > Mailing lists > Public > www-svg@w3.org > October 2000

setBaseVal() bindings

From: Steve Dickson <sdickson@savagesoftware.com>
Date: Tue, 03 Oct 2000 17:38:46 -0700
Message-id: <fc.0085846d000143e30085846d000143e3.143e6@savagesoftware.com>
To: www-svg@w3.org
Some clarification about the expected behaviour in the following situation
please: the various SVGAnimated* interfaces contain setBaseVal() methods
that allow the user to set base values for various attributes.  These
setBaseVal() methods take in primitive type objects such as SVGLength etc.
 What happens if the user passes in the same object as an argument to two
disparate setBaseVal() methods?   The following code fragment illustrates
the problem concisely:

	SVGSVGElement svg1 = (SVGSVGElement&)doc.createElement("svg");
	doc.appendChild(svg1);
	
	SVGCircleElement circle1 = (SVGCircleElement&)doc.createElement("circle");
	svg1.appendChild(circle1);

	SVGAnimatedLength cx = circle1.getCx();
	SVGAnimatedLength cy = circle1.getCy();

	SVGLength ln = svg1.createSVGLength();	   // create unbound SVGLength
	ln.setValue(11.1f);

	cx.setBaseVal(ln);		// binds ln to cx
	cy.setBaseVal(ln);		// ln is already bound to cx; is this valid?

	ln.setValue(22.2f);		// should cx AND cy now be 22.2, or only one?
					// if only one, which one?

This illustration can be extended to the case where ln is passed as a
paremeter to setBaseVal() methods in two or more different elements as
well. e.g.

	[code fragment as above, followed by...]

	SVGRectElement rect1 = (SVGRectElement&)doc.createElement("rect");
	svg1.appendChild(rect1);

	SVGAnimatedLength x = rect1.getX();
	SVGAnimatedLength y = rect1.getY();

	x.setBaseVal(ln);	// ln is already bound
	y.setBaseVal(ln);	// ditto

	ln.setValue(33.3f);	// should ALL of the base values now be 33.3?

----
Steven Dickson, Software Developer,
Savage Software
Received on Tuesday, 3 October 2000 20:38:57 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:19 GMT