Skip to content
This repository has been archived by the owner on Jul 26, 2022. It is now read-only.

Commit

Permalink
Fix Bug 905634 - Prevent fixed position text events have their select…
Browse files Browse the repository at this point in the history
…able state always triggerable even when not currently visible
  • Loading branch information
mjschranz committed Aug 27, 2013
1 parent f14f494 commit d648967
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
8 changes: 5 additions & 3 deletions public/templates/assets/editors/editorhelper.js
Expand Up @@ -60,7 +60,9 @@

EditorHelper.init = function( butter ) {

global.EditorHelper.selectable = function( trackEvent, dragContainer ) {
global.EditorHelper.selectable = function( trackEvent, dragContainer, highlightContainer ) {

highlightContainer = highlightContainer || dragContainer;

var highlight = function() {

Expand All @@ -83,11 +85,11 @@
if ( "zindex" in manifestOptions ) {
var newZIndex = media.maxPluginZIndex - track.order;
if ( trackEvent.selected ) {
dragContainer.classList.add( "track-event-selected" );
highlightContainer.classList.add( "track-event-selected" );
dragContainer.style.zIndex = newZIndex + media.maxPluginZIndex;
} else {
dragContainer.style.zIndex = newZIndex;
dragContainer.classList.remove( "track-event-selected" );
highlightContainer.classList.remove( "track-event-selected" );
}
}
};
Expand Down
5 changes: 4 additions & 1 deletion public/templates/assets/editors/text/text.js
Expand Up @@ -2,6 +2,7 @@

EditorHelper.addPlugin( "text", function( trackEvent ) {
var _container,
_selectableContainer = trackEvent.popcornTrackEvent._innerDiv,
target;

_container = trackEvent.popcornTrackEvent._container;
Expand All @@ -14,9 +15,11 @@ EditorHelper.addPlugin( "text", function( trackEvent ) {
minWidth: 10,
handlePositions: "e,w"
});

_selectableContainer = _container;
}

EditorHelper.selectable( trackEvent, _container );
EditorHelper.selectable( trackEvent, _selectableContainer, _container );
EditorHelper.contentEditable( trackEvent, _container.querySelectorAll( ".popcorn-text div span" ) );
}
});
5 changes: 3 additions & 2 deletions public/templates/assets/plugins/text/popcorn.text.js
Expand Up @@ -167,7 +167,7 @@
container = options._container = document.createElement( "div" ),
innerContainer = document.createElement( "div" ),
innerSpan = document.createElement( "span" ),
innerDiv = document.createElement( "div" ),
innerDiv = options._innerDiv = document.createElement( "div" ),
fontSheet,
fontDecorations = options.fontDecorations || options._natives.manifest.options.fontDecorations[ "default" ],
position = options.position || options._natives.manifest.options.position[ "default" ],
Expand Down Expand Up @@ -241,11 +241,13 @@
if ( options.width ) {
container.style.width = options.width + "%";
}
container.style.zIndex = +options.zindex;
}
else {
container.classList.add( "text-fixed" );
innerContainer.classList.add( position );
innerContainer.classList.add( alignment );
innerDiv.style.zIndex = +options.zindex;
}

if ( linkUrl ) {
Expand All @@ -271,7 +273,6 @@
}
};
fontSheet.href = "//fonts.googleapis.com/css?family=" + options.fontFamily.replace( /\s/g, "+" ) + ":400,700";
container.style.zIndex = +options.zindex;

options.toString = function() {
// use the default option if it doesn't exist
Expand Down

0 comments on commit d648967

Please sign in to comment.