-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Load Daniel font before rendering, provide default styling using inline css #128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
2aef59a
Moved WebFont.load to theme-snap.js so the font will be loaded right …
StefRave 1aa57c2
Close html div tag correctly
StefRave 8570c5f
Added embeded stylesheet in the diagram, so that custom styling is
StefRave 2aec779
Added change on typing, and selecting themes to test.html
StefRave 7c45efc
Don't wobble that close to beginning/end of line for correct marker d…
StefRave 7d6380c
Add a hidden element to the html page to make the browser load the font.
StefRave e03dc21
Merge remote-tracking branch 'upstream/svg' into bramp/svg
StefRave 96379be
Removed webfontloader. The SVG now rendered after the body.load event
StefRave 431896f
Remove unneeded , from bower.json
StefRave File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| <!DOCTYPE html> | ||
| <!DOCTYPE html> | ||
| <!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]--> | ||
| <!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]--> | ||
| <!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]--> | ||
|
|
@@ -15,54 +15,55 @@ | |
| src: local('Daniel'), url('../fonts/daniel/daniel.otf') format('opentype'); | ||
| } | ||
|
|
||
| .sequence.hand { | ||
| /* Override Snap defaults examples */ | ||
| /*override the default font for the "hand" theme*/ | ||
| /*.sequence.hand { | ||
| font-size: 16px; | ||
| font-family: 'Daniel'; | ||
| } | ||
| .signal rect { | ||
| opacity: 0; | ||
| } | ||
| .signal text { | ||
| fill: #000000; | ||
| } | ||
| font-family: 'Consolas'; | ||
| }*/ | ||
|
|
||
| .note rect, | ||
| .note path { | ||
| /* override background color of note */ | ||
| /*.sequence .note rect, | ||
| .sequence .note path { | ||
| fill: #ffff00; | ||
| } | ||
| .title rect, | ||
| .title path, | ||
| .actor rect, | ||
| .actor path { | ||
| fill: #ffffff | ||
| } | ||
| .signal text:hover { | ||
| fill: #aaaaaa | ||
| }*/ | ||
|
|
||
| /* hover signal text color */ | ||
| .sequence .signal line:hover, | ||
| .sequence .signal path:hover { | ||
| stroke: #777777; | ||
| fill: #777777; | ||
| } | ||
| </style> | ||
| </head> | ||
| <body> | ||
| <textarea id="language" rows="10" cols="50"> | ||
| <textarea id="language" rows="10" cols="50"> | ||
| #Note left of A: Note to the\n left of A | ||
| #Note right of A: Note to the\n right of A | ||
| #Note over A: Note over A | ||
| Note over A,B: Note over A,B | ||
| </textarea> | ||
| <button id="parse" type="button">Click Me!</button> | ||
| A -> B: hello | ||
| A -->> B: bye | ||
| </textarea> | ||
| <div style="display: inline-block"> | ||
| <label style="display: block"><input type="checkbox" name="themeChoice" value="hand" checked="checked">SVG hand</label> | ||
| <label style="display: block"><input type="checkbox" name="themeChoice" value="simple" checked="checked">SVG simple</label> | ||
| <label style="display: block"><input type="checkbox" name="themeChoice" value="oldHand">Raphaël hand</label> | ||
| <label style="display: block"><input type="checkbox" name="themeChoice" value="oldSimple">Raphaël simple</label> | ||
| </div> | ||
|
|
||
| <svg id="diagram"></svg> | ||
| <div id="diagram"></div> | ||
|
|
||
| <!--<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>--> | ||
| <script src="../bower_components/jquery/jquery.min.js"></script> | ||
| <!--<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>--> | ||
| <script src="../bower_components/jquery/jquery.min.js"></script> | ||
|
|
||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Opening div tag, but closing svg tag... |
||
| <script src="../bower_components/underscore/underscore-min.js"></script> | ||
| <script src="../bower_components/lodash/lodash.min.js"></script> | ||
| <script src="../bower_components/snap.svg/dist/snap.svg.js"></script> | ||
| <script src="../bower_components/bower-webfontloader/webfont.js"></script> | ||
| <script src="../bower_components/raphael/raphael-min.js"></script> | ||
| <script src="../bower_components/underscore/underscore-min.js"></script> | ||
| <script src="../bower_components/lodash/lodash.min.js"></script> | ||
| <script src="../bower_components/snap.svg/dist/snap.svg.js"></script> | ||
| <script src="../bower_components/raphael/raphael-min.js"></script> | ||
|
|
||
| <!-- | ||
|
|
||
| <!-- | ||
| <script src="../build/diagram-grammar.js"></script> | ||
| <script src="../src/theme.js"></script> | ||
| <script src="../src/theme-snap.js"></script> | ||
|
|
@@ -72,34 +73,32 @@ | |
| <script src="../src/sequence-diagram.js"></script> | ||
| <script src="../src/jquery-plugin.js"></script> | ||
| --> | ||
| <!--script src="../build/sequence-diagram.js"></script--> | ||
|
|
||
| <!--script src="../build/sequence-diagram.js"></script--> | ||
|
|
||
| <script src="../build/sequence-diagram-min.js"></script> | ||
| <script> | ||
| $(document).ready(function(){ | ||
| $('#parse').click(_.throttle( function() { | ||
| <script src="../build/sequence-diagram-min.js"></script> | ||
| <script> | ||
| $(window).load(function () { | ||
| function draw() { | ||
| $("#diagram").empty(); | ||
|
|
||
| //try { | ||
| var diagram = Diagram.parse($('#language').val()); | ||
| console.log(diagram); | ||
|
|
||
| WebFont.load({ | ||
| custom: { | ||
| families: ['Daniel'] | ||
| }, | ||
| active: function () { | ||
| diagram.drawSVG('#diagram', {theme: 'hand'}); | ||
| } | ||
| $($('input[name=themeChoice]:checked').get().reverse()).each(function () { | ||
| diagram.drawSVG('diagram', { theme: $(this).val() }); | ||
| }); | ||
| //} catch (e) { | ||
| // console.log(e); | ||
| //} | ||
| }, 100)); | ||
| }); | ||
| </script> | ||
| </body> | ||
| </html> | ||
|
|
||
|
|
||
| } | ||
|
|
||
| draw(); | ||
|
|
||
| $('input[name=themeChoice]').on("change", function() { draw() }); | ||
| $('#language').on("change input paste", _.throttle(function () { | ||
| //try { | ||
| draw(); | ||
| //} catch (e) { | ||
| // console.log(e); | ||
| //} | ||
| }, 100)); | ||
| }); | ||
| </script> | ||
| </body> | ||
| </html> | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I was being lazy :)