Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
dream
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
dream
Commits
05a8798f
Commit
05a8798f
authored
Nov 19, 2013
by
Kazuhiko Shiozaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
store node_style in preference.
parent
7ceb2dad
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
9 deletions
+37
-9
dream/platform/static/src/dream_launcher.js
dream/platform/static/src/dream_launcher.js
+4
-2
dream/platform/static/src/jsonPlumb.js
dream/platform/static/src/jsonPlumb.js
+33
-7
No files found.
dream/platform/static/src/dream_launcher.js
View file @
05a8798f
...
...
@@ -238,10 +238,12 @@
_id
:
"
dream_demo
"
},
function
(
err
,
response
)
{
if
(
response
!==
undefined
&&
response
.
data
!==
undefined
)
{
var
preference
=
response
.
data
.
preference
!==
undefined
?
response
.
data
.
preference
:
{};
dream_instance
.
setPreferences
(
preference
);
// Add all elements
$
.
each
(
response
.
data
.
nodes
,
function
(
key
,
value
)
{
var
preference
=
response
.
data
.
preference
!==
undefined
?
response
.
data
.
preference
:
{};
var
coordinates
=
preference
[
'
coordinates
'
]
||
{};
var
coordinate
=
coordinates
[
key
]
||
{};
value
[
'
coordinate
'
]
=
{};
...
...
dream/platform/static/src/jsonPlumb.js
View file @
05a8798f
...
...
@@ -128,6 +128,21 @@
return
coordinate
;
};
priv
.
updateNodeStyle
=
function
(
element_id
)
{
var
node_style
=
priv
.
preference_container
[
'
node_style
'
]
||
{};
var
element
=
$
(
"
#
"
+
element_id
);
element
.
css
(
node_style
);
};
priv
.
saveNodeStyle
=
function
(
style_dict
)
{
var
node_style
=
priv
.
preference_container
[
'
node_style
'
]
||
{};
$
.
each
(
style_dict
,
function
(
k
,
v
)
{
node_style
[
k
]
=
v
;
});
priv
.
preference_container
[
'
node_style
'
]
=
node_style
;
priv
.
onDataChange
();
};
priv
.
draggable
=
function
()
{
// make all the window divs draggable
var
stop
=
function
(
el
)
{
...
...
@@ -171,7 +186,7 @@
var
left
=
Math
.
floor
(
pos
.
left
*
(
canvas_size_x
-
size_x
))
+
"
px
"
;
priv
.
updateElementCoordinate
(
node
,
{
top
:
top
,
left
:
left
,
left
:
left
});
$
(
'
#
'
+
node
).
css
(
'
top
'
,
top
);
$
(
'
#
'
+
node
).
css
(
'
left
'
,
left
);
...
...
@@ -184,21 +199,27 @@
that
.
zoom_in
=
function
()
{
var
attr_list
=
[
'
width
'
,
'
height
'
,
'
font-size
'
,
'
padding-top
'
,
'
line-height
'
]
'
line-height
'
];
var
style_dict
=
{};
$
.
each
(
attr_list
,
function
(
i
,
j
)
{
$
(
'
.window
'
).
css
(
j
,
$
(
'
.window
'
).
css
(
j
).
replace
(
'
px
'
,
''
)
*
1.1111
+
'
px
'
);
var
new_value
=
$
(
'
.window
'
).
css
(
j
).
replace
(
'
px
'
,
''
)
*
1.1111
+
'
px
'
;
$
(
'
.window
'
).
css
(
j
,
new_value
);
style_dict
[
j
]
=
new_value
;
});
priv
.
saveNodeStyle
(
style_dict
);
jsPlumb
.
repaintEverything
();
};
that
.
zoom_out
=
function
()
{
var
attr_list
=
[
'
width
'
,
'
height
'
,
'
font-size
'
,
'
padding-top
'
,
'
line-height
'
]
'
line-height
'
];
var
style_dict
=
{};
$
.
each
(
attr_list
,
function
(
i
,
j
)
{
$
(
'
.window
'
).
css
(
j
,
$
(
'
.window
'
).
css
(
j
).
replace
(
'
px
'
,
''
)
*
0.9
+
'
px
'
);
var
new_value
=
$
(
'
.window
'
).
css
(
j
).
replace
(
'
px
'
,
''
)
*
0.9
+
'
px
'
;
$
(
'
.window
'
).
css
(
j
,
new_value
);
style_dict
[
j
]
=
new_value
;
});
priv
.
saveNodeStyle
(
style_dict
);
jsPlumb
.
repaintEverything
();
};
...
...
@@ -257,6 +278,10 @@
});
};
that
.
setPreferences
=
function
(
preferences
)
{
priv
.
preference_container
=
preferences
;
};
that
.
setGeneralProperties
=
function
(
properties
)
{
priv
.
general_container
=
properties
;
priv
.
onDataChange
();
...
...
@@ -275,6 +300,7 @@
box
=
$
(
"
#
"
+
element
.
id
);
box
.
css
(
"
top
"
,
coordinate
.
top
);
box
.
css
(
"
left
"
,
coordinate
.
left
);
priv
.
updateNodeStyle
(
element
.
id
);
// Initial DEMO code : make all the window divs draggable
priv
.
draggable
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment