100pah commented on a change in pull request #10743: Fix: graphic group position
URL: 
https://github.com/apache/incubator-echarts/pull/10743#discussion_r297662788
 
 

 ##########
 File path: src/component/graphic.js
 ##########
 @@ -338,8 +340,24 @@ echarts.extendComponentView({
 
             var el = elMap.get(id);
             if (el) {
-                el.__ecGraphicWidth = elOption.width;
-                el.__ecGraphicHeight = elOption.height;
+                var isParentRoot = targetElParent === rootGroup;
+                var parentWidth = isParentRoot
+                    ? api.getWidth()
+                    // Like 'position:absolute' in css, default 0.
+                    : (targetElParent.__ecGraphicWidth || 0);
+                var parentHeight = isParentRoot
+                    ? api.getHeight()
+                    : (targetElParent.__ecGraphicHeight || 0);
+
+                var isGroup = el.type === 'group';
+                el.__ecGraphicWidth = isGroup
+                    ? parsePercent(elOption.width, parentWidth)
+                    : parentWidth;
+                el.__ecGraphicHeight = isGroup
+                    ? parsePercent(elOption.height, parentHeight)
+                    : parentHeight;
+
+                console.log(el.type, el.__ecGraphicWidth, 
el.__ecGraphicHeight);
 
 Review comment:
   delete it

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to