In an mxGraph / grapheditor-like app, one of my palette symbols is almost always messed up. As shown in the clip, the first symbol in a palette will have a bunch of extra paths in the svg; also, it will not be scaled down to the right size like the rest of the symbols. It is always this same exact set of paths, which don't seem to be related to anything I've done intentionally (except that the green is one of my key colors), and it only happens on one palette at a time. But when I reload the page, it might move to a different palette. It happens on image palettes and component palettes. I see it in Chrome, Fireforx, and IE9. When I place the symbol on the drawing page, the extra paths do not appear. Do you have any idea what might be generating these extra paths?

I am using mxGraph 1.10.4.1 but I saw this in earlier versions too. I do not see the problem when I go to www.draw.io, so it must be something in my code. I hope you can give me some idea of where to look.

alt text

asked 03 Jan '13, 00:18

lannie's gravatar image

lannie
7512
accept rate: 22%


I finally figured out where the weird paths are coming from: They are coming from the createEdgeTemplate()'s at the end of the General palette. I deleted them, and no more problem (which had reared its ugly head again). Now I need to figure out why they caused a problem, and how to fix it. (My grapheditor is embedded within a backbone.js framework, and the sidebar is treated somewhat differently than in the example, so the problem may lie therein.)

link

answered 31 Jan '13, 14:08

lannie's gravatar image

lannie
7512
accept rate: 22%

Okay, final resolution: I mucked myself up (surprise surprise) by modifying createVertexTemplate() and underlying functions. I needed to go back and make compatible changes to createEdgeTemplate() work with the modified underlying functions. (These are grapheditor functions, not mxGraph core.)

(01 Feb '13, 12:24) lannie

Are you using the latest diagramly.min.js? Or, if you are using grapheditor example, how are you adding those entries to the sidebar?

link

answered 03 Jan '13, 12:41

Gaudenz's gravatar image

Gaudenz
80.1k1310
accept rate: 39%

edited 03 Jan '13, 12:45

I am not using diagramly.min.js, I am using mxClient.js. I am adding the palette entries just like in grapheditor; for example, the arrows shown in the clip are added by this code:

this.addStencilPalette('arrows', mxPrettyPrint('arrows'), STENCIL_PATH + '/arrows.xml', ';fillColor=#ffffff; strokeColor=#000000; strokeWidth=2');

(03 Jan '13, 15:01) lannie

Looks OK. Any other noteworthy changes in Sidebar.js?

(04 Jan '13, 06:21) Gaudenz

I pulled in some updates from the latest grapheditor/Sidebar.js and the problem has gone away. I did some regressions to try to identify exactly what fixed the problem, but now I am unable to reproduce the failure. Oh well. Thank you for your time!

(05 Jan '13, 16:06) lannie
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×228
×6

Asked: 03 Jan '13, 00:18

Seen: 1,894 times

Last updated: 01 Feb '13, 12:24