golden-layout
Advanced tools
Comparing version 1.0.4 to 1.0.5
{ | ||
"name": "golden-layout", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"author": "Hoxton One Ltd.", | ||
@@ -5,0 +5,0 @@ "license": "Creative Commons Attribution-NonCommercial 4.0 International License", |
lm.config.itemDefaultConfig = { | ||
isClosable: true, | ||
reorderEnabled: true, | ||
title: '' | ||
}; |
@@ -17,2 +17,5 @@ /** | ||
lm.controls.DragProxy = function( x, y, dragListener, layoutManager, contentItem, originalParent ) { | ||
lm.utils.EventEmitter.call( this ); | ||
this._dragListener = dragListener; | ||
@@ -19,0 +22,0 @@ this._layoutManager = layoutManager; |
@@ -22,4 +22,7 @@ /** | ||
this._layoutManager = this.contentItem.layoutManager; | ||
if( this._layoutManager.config.settings.reorderEnabled === true ) { | ||
if( | ||
this._layoutManager.config.settings.reorderEnabled === true && | ||
contentItem.config.reorderEnabled === true | ||
) { | ||
this._dragListener = new lm.utils.DragListener( this.element ); | ||
@@ -143,3 +146,3 @@ this._dragListener.on( 'dragStart', this._onDragStart, this ); | ||
// middle mouse button | ||
} else if( event.button === 1 ) { | ||
} else if( event.button === 1 && this.contentItem.config.isClosable ) { | ||
this._onCloseClick( event ); | ||
@@ -162,2 +165,2 @@ } | ||
} | ||
}); | ||
}); |
@@ -737,3 +737,3 @@ /** | ||
var windowConfig = lm.utils.getQueryStringParam( 'gl-window' ); | ||
debugger; | ||
if( windowConfig ) { | ||
@@ -774,3 +774,3 @@ this.isSubWindow = true; | ||
document.title = this.config.content[ 0 ].title; | ||
document.title = lm.utils.stripTags( this.config.content[ 0 ].title ); | ||
@@ -777,0 +777,0 @@ $( 'head' ).append( $( 'body link, body style, template, .gl_keep' ) ); |
@@ -32,3 +32,4 @@ lm.utils.DragListener = function(eElement, nButtonCode) | ||
this._eElement.mousedown( this._fDown ); | ||
this._eElement.on( 'mousedown touchstart', this._fDown ); | ||
}; | ||
@@ -40,3 +41,3 @@ | ||
destroy: function() { | ||
this._eElement.unbind( 'mousedown', this._fDown ); | ||
this._eElement.unbind( 'mousedown touchstart', this._fDown ); | ||
}, | ||
@@ -47,8 +48,10 @@ | ||
oEvent.preventDefault(); | ||
var coordinates = this._getCoordinates( oEvent ); | ||
this._nOriginalX = oEvent.pageX; | ||
this._nOriginalY = oEvent.pageY; | ||
this._nOriginalX = coordinates.x; | ||
this._nOriginalY = coordinates.y; | ||
this._oDocument.on('mousemove', this._fMove); | ||
this._oDocument.one('mouseup', this._fUp); | ||
this._oDocument.on('mousemove touchmove', this._fMove); | ||
this._oDocument.one('mouseup touchend', this._fUp); | ||
@@ -62,5 +65,7 @@ this._timeout = setTimeout( lm.utils.fnBind( this._startDrag, this ), this._nDelay ); | ||
this._nX = oEvent.pageX - this._nOriginalX; | ||
this._nY = oEvent.pageY - this._nOriginalY; | ||
var coordinates = this._getCoordinates( oEvent ); | ||
this._nX = coordinates.x - this._nOriginalX; | ||
this._nY = coordinates.y - this._nOriginalY; | ||
if( this._bDragging === false ) { | ||
@@ -86,3 +91,3 @@ if( | ||
this._eBody.removeClass( 'lm_dragging' ); | ||
this._oDocument.unbind( 'mousemove', this._fMove); | ||
this._oDocument.unbind( 'mousemove touchmove', this._fMove); | ||
@@ -101,4 +106,17 @@ if( this._bDragging === true ) | ||
this.emit('dragStart', this._nOriginalX, this._nOriginalY); | ||
}, | ||
_getCoordinates: function( event ) { | ||
var coordinates = {}; | ||
if( event.type.substr( 0, 5 ) === 'touch' ) { | ||
coordinates.x = event.originalEvent.targetTouches[ 0 ].pageX; | ||
coordinates.y = event.originalEvent.targetTouches[ 0 ].pageY; | ||
} else { | ||
coordinates.x = event.pageX; | ||
coordinates.y = event.pageY; | ||
} | ||
return coordinates; | ||
} | ||
}); | ||
}); |
46
start.js
var config = { | ||
content: [{ | ||
type: 'row', | ||
content: [ | ||
{ | ||
type:'component', | ||
componentName: 'example', | ||
componentState: { text: 'Component 1' }, | ||
title: 'AAA' | ||
}, | ||
{ | ||
type:'component', | ||
componentName: 'example', | ||
componentState: { text: 'Component 2' }, | ||
title: 'BBB' | ||
}, | ||
{ | ||
isClosable: false, | ||
type: 'stack', | ||
content: [] | ||
} | ||
] | ||
}] | ||
content: [{ | ||
type: 'row', | ||
content:[{ | ||
type: 'component', | ||
componentName: 'testComponent', | ||
componentState: { label: 'A' } | ||
},{ | ||
type: 'column', | ||
content:[{ | ||
type: 'component', | ||
title: '<b style="color:red">Hey</b>Ho', | ||
componentName: 'testComponent', | ||
componentState: { label: 'B' } | ||
},{ | ||
type: 'component', | ||
componentName: 'testComponent', | ||
componentState: { label: 'C' } | ||
}] | ||
}] | ||
}] | ||
}; | ||
@@ -28,6 +26,6 @@ | ||
myLayout.registerComponent( 'example', function( container, state ){ | ||
container.getElement().html( '<h2>' + state.text + '</h2>'); | ||
myLayout.registerComponent( 'testComponent', function( container, componentState ){ | ||
container.getElement().html( '<h2>' + componentState.label + '</h2>' ); | ||
}); | ||
myLayout.init(); |
Copyleft License
License(Experimental) Copyleft license information was found.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
Non-permissive License
License(Experimental) A license not known to be considered permissive was found.
Found 1 instance in 1 package
Non-permissive License
License(Experimental) A license not known to be considered permissive was found.
Found 1 instance in 1 package
650403
70
10671
3
70