From batik-users-return-10601-apmail-xmlgraphics-batik-users-archive=xmlgraphics.apache.org@xmlgraphics.apache.org Wed Jun 21 04:17:37 2006 Return-Path: Delivered-To: apmail-xmlgraphics-batik-users-archive@www.apache.org Received: (qmail 24019 invoked from network); 21 Jun 2006 04:17:37 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 21 Jun 2006 04:17:37 -0000 Received: (qmail 37309 invoked by uid 500); 21 Jun 2006 04:17:36 -0000 Delivered-To: apmail-xmlgraphics-batik-users-archive@xmlgraphics.apache.org Received: (qmail 37037 invoked by uid 500); 21 Jun 2006 04:17:35 -0000 Mailing-List: contact batik-users-help@xmlgraphics.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: batik-users@xmlgraphics.apache.org Delivered-To: mailing list batik-users@xmlgraphics.apache.org Delivered-To: moderator for batik-users@xmlgraphics.apache.org Received: (qmail 92600 invoked by uid 99); 21 Jun 2006 03:25:44 -0000 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=RCVD_IN_SORBS_WEB,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of SRS0=Ih5.xt=AI=kiyut.com=tonny@yourhostingaccount.com designates 65.254.253.40 as permitted sender) Subject: Re: Multiple Group Elements Selection and Moving From: Tonny Kohar To: batik-users@xmlgraphics.apache.org In-Reply-To: <4949560.post@talk.nabble.com> References: <4902855.post@talk.nabble.com> <1150518876.2552.4.camel@localhost.localdomain> <4911693.post@talk.nabble.com> <4914471.post@talk.nabble.com> <4921349.post@talk.nabble.com> <4931198.post@talk.nabble.com> <1150775275.2482.12.camel@localhost.localdomain> <4949560.post@talk.nabble.com> Content-Type: text/plain Date: Wed, 21 Jun 2006 10:20:49 +0700 Message-Id: <1150860049.2568.18.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.2.2 (2.2.2-5) Content-Transfer-Encoding: 7bit X-EN-UserInfo: 61019b829653a4ee6fa136a52448aea6:e4adf8077276e43dfe1dc4cd74d8432e X-EN-AuthUser: hau_h Sender: Tonny Kohar X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Hi, On Mon, 2006-06-19 at 22:52 -0700, Sudhakar S wrote: > Hi Tonny Kohar, > > Problem is, finding the transform attribute for multiple group elements. > After saved into xml file, if i check the values, it is correct for last > selected group element. But other group elements transform value is not > correct. so can you please explain how to find the transform attributes for > all the selected elements correctly? Here is what we done in our SVG editor // on mouse pressed we keep the x, y position of the mouse // and reset the tx,ty (for transform attr later) public void mousePressed(MouseEvent e) { startX = e.getX(); startY = e.getY(); tx = 0; ty = 0; ... } // on mouse dragged we keep updating the tx and ty to calculate the delta public void mouseDragged(MouseEvent e) { tx = e.getX() - startX; ty = e.getY() - startY; ... } // on mouse released we apply the delta to the element (either single or multiple element public void mouseReleased(MouseEvent e) { /* for each element that selected calculate the element transform (if any), or any transform into the tx and ty change the attribute for element x and y according to the tx n ty by adding existing element.x with tx and element.y with ty eg: SVGRectElement svgElement = (SVGRectElement)element; SVGLength lengthX = svgElement.getX().getBaseVal(); SVGLength lengthY = svgElement.getY().getBaseVal(); lengthX.setValue(lengthX.getValue()+tx); lengthY.setValue(lengthY.getValue()+ty); */ } Regards Tonny Kohar -- Sketsa SVG Graphics Editor http://www.kiyut.com --------------------------------------------------------------------- To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org