Skip to content
This repository was archived by the owner on Nov 25, 2020. It is now read-only.

Master.rename context #15

Merged
merged 5 commits into from
Mar 26, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/components/buttons/buttonmenu.coffee
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
JContextMenu = require './../contextmenu/contextmenu.coffee'
KDContextMenu = require './../contextmenu/contextmenu.coffee'

module.exports = class JButtonMenu extends JContextMenu
module.exports = class JButtonMenu extends KDContextMenu

constructor:(options = {}, data)->

Expand Down
16 changes: 8 additions & 8 deletions src/components/contextmenu/contextmenu.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ KDView = require './../../core/view.coffee'
KDCustomHTMLView = require './../../core/customhtmlview.coffee'
JContextMenuTreeViewController = require './contextmenutreeviewcontroller.coffee'

module.exports = class JContextMenu extends KDView
module.exports = class KDContextMenu extends KDView

constructor:(options = {}, data)->

options.cssClass = @utils.curry "jcontextmenu", options.cssClass
options.menuMaxWidth or= 272
options.menuMinWidth or= 172
options.cssClass = @utils.curry "kdcontextmenu", options.cssClass
options.menuMaxWidth or= "auto"
options.menuMinWidth or= "auto"
options.menuWidth or= 172
options.offset or= {}
options.offset.left or= 0
Expand Down Expand Up @@ -108,8 +108,10 @@ module.exports = class JContextMenu extends KDView
mainHeight = mainView.getHeight()
mainWidth = mainView.getWidth()

menuHeight = @getHeight()
menuWidth = @getWidth()
{ menuWidth, menuHeight, menuMaxWidth, menuMinWidth } = options

menuHeight ?= @getHeight()
menuWidth ?= @getWidth()

top = (options.y or event.pageY or 0) + options.offset.top
left = (options.x or event.pageX or 0) + options.offset.left
Expand All @@ -126,15 +128,13 @@ module.exports = class JContextMenu extends KDView
@topMargin = expectedTop - top
@leftMargin = expectedLeft - left

{menuWidth, menuMaxWidth, menuMinWidth} = options

style =
width : "#{menuWidth}px"
top : top
left : left

if menuMaxWidth
style.width = "auto"
style.maxWidth = "#{menuMaxWidth}px"

style.minWidth = "#{menuMinWidth}px" if menuMinWidth
Expand Down
2 changes: 1 addition & 1 deletion src/themes/default/kd.buttons.styl
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
kdfsprite()
bg position,-80px -280px

.kdbuttonmenu.jcontextmenu
.kdbuttonmenu.kdcontextmenu
width auto
min-width 0
rounded 3px 0 3px 3px
Expand Down
19 changes: 8 additions & 11 deletions src/themes/default/kd.contextmenu.styl
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
@import "./kdfn"

/*
** JContextMenu STYLES
** KDContextMenu STYLES
*/
.jcontextmenu
.kdcontextmenu
display inline-block
size auto auto
abs -1000px 0 0 -1000px
Expand All @@ -19,7 +19,6 @@
margin 0
padding 0
size auto,auto
min-width 150px
overflow visible
bg color,rgba(255,255,255,.95)
shadow 0 7px 15px rgba(0,0,0,.17)
Expand All @@ -28,9 +27,8 @@
.kdlistview-contextmenu.default
margin-top -29px
rounded 0 2px 2px 0
abs()
left 100%
min-width 160px
abs()

&.left-aligned
rounded 2px 0 0 2px
Expand All @@ -50,7 +48,6 @@
color #444
cursor pointer
size auto,auto
min-width 100px

&.selected
color white
Expand Down Expand Up @@ -109,16 +106,16 @@
&.top
border-bottom-color white
bottom 100%
margin-left 3px
margin-left 0
&.right
border-left-color white
left 100%
margin-top 3px
margin-top 0
&.bottom
top 100%
border-top-color white
margin-left 3px
top 100%
margin-left 0
&.left
right 100%
border-right-color white
margin-top 3px
margin-top 0