Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DMDesign
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Amanda Ghassaei
DMDesign
Commits
f18dc6d4
Commit
f18dc6d4
authored
9 years ago
by
Amanda Ghassaei
Browse files
Options
Downloads
Patches
Plain Diff
script menu
parent
ae26f99d
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
js/menus/MenuWrapperView.js
+2
-3
2 additions, 3 deletions
js/menus/MenuWrapperView.js
js/menus/PartMenuView.js
+8
-45
8 additions, 45 deletions
js/menus/PartMenuView.js
with
10 additions
and
48 deletions
js/menus/MenuWrapperView.js
+
2
−
3
View file @
f18dc6d4
...
...
@@ -22,7 +22,6 @@ MenuWrapper = Backbone.View.extend({
//init all tab view controllers
this
.
sketchMenu
=
new
SketchMenuView
({
model
:
lattice
,
appState
:
this
.
model
});
this
.
partMenu
=
new
PartMenuView
({
model
:
this
.
model
,
lattice
:
lattice
});
this
.
scriptMenu
=
new
ScriptMenuView
({
model
:
this
.
model
});
this
.
physicsMenu
=
new
PhysicsMenuView
({
model
:
this
.
model
});
this
.
materialMenu
=
new
MaterialMenuView
({
model
:
this
.
model
});
...
...
@@ -43,13 +42,11 @@ MenuWrapper = Backbone.View.extend({
_onKeyUp
:
function
(
e
){
if
(
$
(
"
input
"
).
is
(
"
:focus
"
)
&&
e
.
keyCode
==
13
)
{
//enter key
$
(
e
.
target
).
blur
();
this
.
_renderTab
();
return
;
}
if
(
$
(
"
.floatInput
"
).
is
(
"
:focus
"
))
this
.
_updateFloat
(
e
);
if
(
$
(
"
.intInput
"
).
is
(
"
:focus
"
))
this
.
_updateInt
(
e
);
},
...
...
@@ -85,6 +82,7 @@ MenuWrapper = Backbone.View.extend({
var
key
=
$target
.
data
(
"
key
"
);
if
(
key
){
if
(
$target
.
hasClass
(
"
lattice
"
))
globals
.
lattice
.
get
(
property
)[
key
]
=
newVal
;
globals
.
lattice
.
trigger
(
"
change:
"
+
property
);
return
;
}
if
(
$target
.
hasClass
(
"
lattice
"
))
globals
.
lattice
.
set
(
property
,
newVal
);
...
...
@@ -137,6 +135,7 @@ MenuWrapper = Backbone.View.extend({
}
else
if
(
tabName
==
"
sketch
"
){
this
.
sketchMenu
.
render
();
}
else
if
(
tabName
==
"
part
"
){
if
(
!
this
.
partMenu
)
this
.
partMenu
=
new
PartMenuView
({
model
:
this
.
model
});
this
.
partMenu
.
render
();
}
else
if
(
tabName
==
"
script
"
){
this
.
scriptMenu
.
render
();
...
...
This diff is collapsed.
Click to expand it.
js/menus/PartMenuView.js
+
8
−
45
View file @
f18dc6d4
...
...
@@ -7,57 +7,20 @@ PartMenuView = Backbone.View.extend({
el
:
"
#menuContent
"
,
events
:
{
"
click .partType
"
:
"
_changePartType
"
,
"
click .materialType
"
:
"
_changeMaterialType
"
},
initialize
:
function
(
options
){
this
.
lattice
=
options
.
lattice
;
initialize
:
function
(){
_
.
bindAll
(
this
,
"
render
"
);
_
.
bindAll
(
this
,
"
_onKeyup
"
);
//bind events
this
.
listenTo
(
this
.
lattice
,
"
change
"
,
this
.
render
);
$
(
document
).
bind
(
'
keyup
'
,
{
state
:
false
},
this
.
_onKeyup
);
},
_onKeyup
:
function
(
e
){
if
(
this
.
model
.
get
(
"
currentTab
"
)
!=
"
part
"
)
return
;
if
(
$
(
"
input
"
).
is
(
"
:focus
"
)
&&
e
.
keyCode
==
13
)
{
//enter key
$
(
e
.
target
).
blur
();
this
.
render
();
return
;
}
if
(
$
(
"
.cellSeparation
"
).
is
(
"
:focus
"
))
this
.
_updateNumber
(
e
,
"
cellSeparation
"
);
},
_updateNumber
:
function
(
e
,
property
){
e
.
preventDefault
();
var
newVal
=
parseFloat
(
$
(
e
.
target
).
val
());
if
(
isNaN
(
newVal
))
return
;
var
object
=
this
.
lattice
.
get
(
property
);
object
[
$
(
e
.
target
).
data
(
"
type
"
)]
=
newVal
;
this
.
lattice
.
trigger
(
"
change:
"
+
property
);
},
_changePartType
:
function
(
e
){
e
.
preventDefault
();
this
.
lattice
.
set
(
"
partType
"
,
$
(
e
.
target
).
data
(
"
type
"
));
},
_changeMaterialType
:
function
(
e
){
e
.
preventDefault
();
this
.
lattice
.
set
(
"
materialType
"
,
$
(
e
.
target
).
data
(
"
type
"
));
//bind events
this
.
listenTo
(
globals
.
lattice
,
"
change
"
,
this
.
render
);
},
render
:
function
(){
if
(
this
.
model
.
changedAttributes
()[
"
currentNav
"
])
return
;
if
(
this
.
model
.
get
(
"
currentTab
"
)
!=
"
part
"
)
return
;
this
.
$el
.
html
(
this
.
template
(
_
.
extend
(
this
.
model
.
toJSON
(),
thi
s
.
lattice
.
toJSON
())));
this
.
$el
.
html
(
this
.
template
(
_
.
extend
(
global
s
.
lattice
.
toJSON
()
,
globals
.
plist
)));
},
template
:
_
.
template
(
'
\
...
...
@@ -66,13 +29,13 @@ PartMenuView = Backbone.View.extend({
<button data-toggle="dropdown" class="btn dropdown-toggle" type="button"><%= allPartTypes[cellType][connectionType][partType] %><span class="caret"></span></button>
\
<ul role="menu" class="dropdown-menu">
\
<% _.each(_.keys(allPartTypes[cellType][connectionType]), function(key){ %>
\
<li><a class="partType" data-
typ
e="<%= key %>" href="#"><%= allPartTypes[cellType][connectionType][key] %></a></li>
\
<li><a class="
lattice dropdownSelector" data-property="
partType" data-
valu
e="<%= key %>" href="#"><%= allPartTypes[cellType][connectionType][key] %></a></li>
\
<% }); %>
\
</ul>
\
</div><br/><br/>
\
Cell Separation <% if (connectionType != "freeformFace"){ %>(xy, z): <input data-
type
="xy" value="<%= cellSeparation.xy %>" placeholder="XY" class="form-control
numberInput cellSeparation
" type="text">
\
<input data-
type
="z" value="<%= cellSeparation.z %>" placeholder="Z" class="form-control
numberInput cellSeparation
" type="text">
\
<% } else { %>( radial ): <input data-
type
="xy" value="<%= cellSeparation.xy %>" placeholder="XY" class="form-control
numberInput cellSeparation
" type="text"><% } %>
\
Cell Separation <% if (connectionType != "freeformFace"){ %>(xy, z): <input data-
property="cellSeparation" data-key
="xy" value="<%= cellSeparation.xy %>" placeholder="XY" class="form-control
floatInput lattice
" type="text">
\
<input data-
property="cellSeparation" data-key
="z" value="<%= cellSeparation.z %>" placeholder="Z" class="form-control
floatInput lattice
" type="text">
\
<% } else { %>( radial ): <input data-
property="cellSeparation" data-key
="xy" value="<%= cellSeparation.xy %>" placeholder="XY" class="form-control
floatInput lattice
" type="text"><% } %>
\
<br/><br/>
\
<% if (allMaterialTypes[cellType][connectionType]){ %>
\
Material Type: <div class="btn-group">
\
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment