From aabd9b98341308cd0d276e6e788b7a3f9531c394 Mon Sep 17 00:00:00 2001 From: Jon Reid Date: Thu, 21 Jun 2012 11:32:20 -0700 Subject: Timeline: Bug Fix: Document switching was doubling position tracks. --- js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | 1 - js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js | 5 +++++ 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'js') diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index 89389469..b8ba5feb 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js @@ -595,7 +595,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { prepareForDraw:{ value:function () { this.initTimeline(); - } }, diff --git a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js index bf380e00..3cf754b8 100644 --- a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js +++ b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js @@ -1051,6 +1051,11 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { createPositionTracks:{ value:function(){ // create track objects for position and transform tracks and push into arrays + + // ... but only do it if we haven't already. + if (this.arrPositionTracks.length > 0) { + return; + } // create 'left' track var newLeftTrack = {}; -- cgit v1.2.3 From 403d0834a23760c2481be050a8be925c1ba64a1b Mon Sep 17 00:00:00 2001 From: Jon Reid Date: Thu, 21 Jun 2012 12:14:59 -0700 Subject: Timeline: Bug fix IKNINJA-1783, Timeline panel is disabled when CSS file is open in another tab. --- js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'js') diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index b8ba5feb..1ba9f067 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js @@ -118,9 +118,17 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { return; } - if(!this._currentDocument && value.currentView === "design") { - this.enablePanel(true); - } + // Should we enable the panel? + if (typeof(this._currentDocument) !== "undefined") { + // We have a document, or at least we have initialized the panel. + // What view are we in? + if (typeof(value) !== "undefined") { + if (value.currentView === "design") { + // We are in design view, so enable the panel. + this.enablePanel(true); + } + } + } this._currentDocument = value; @@ -893,7 +901,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { this.drawTimeMarkers(); // Document switching // Check to see if we have saved timeline information in the currentDocument. - //console.log("TimelinePanel.initTimelineForDocument"); + // console.log("TimelinePanel.initTimelineForDocument"); if ((typeof(this.application.ninja.currentDocument.isTimelineInitialized) === "undefined")) { // console.log('TimelinePanel.initTimelineForDocument: new Document'); -- cgit v1.2.3 From 2a9c33a46eb33bb4f25623217c781e9bf16221d9 Mon Sep 17 00:00:00 2001 From: Jon Reid Date: Thu, 21 Jun 2012 12:48:11 -0700 Subject: Timeline: Bug fix IKNINJA-1755 Can't insert keyframes in a CSS style property of an object on top layer --- js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js') diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index 1ba9f067..c8caf50e 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js @@ -1975,7 +1975,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { returnVal = false, arrLayersLength = this.arrLayers.length; for (i = 0; i < arrLayersLength; i++) { - if (this.arrLayers[i].isSelected === true) { + if (this.arrLayers[i].layerData.isSelected === true) { returnVal = i; } } -- cgit v1.2.3 From cf3b17036985243ecbcafdf55189530c797c78a7 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Thu, 21 Jun 2012 15:33:18 -0700 Subject: Draw stage left and top references lines. Signed-off-by: Nivesh Rajbhandari --- js/helper-classes/3D/draw-utils.js | 65 ++++++++++++++++++-------------------- js/helper-classes/3D/math-utils.js | 4 +-- js/helper-classes/3D/view-utils.js | 32 +++++++++++++++++++ 3 files changed, 65 insertions(+), 36 deletions(-) (limited to 'js') diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js index 8ddd0d52..c31424eb 100755 --- a/js/helper-classes/3D/draw-utils.js +++ b/js/helper-classes/3D/draw-utils.js @@ -630,6 +630,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { value: function () { this.application.ninja.stage.clearGridCanvas(); + this.drawStageOutline(); if (!this.isDrawingGrid()) return; var saveContext = this.getDrawingSurfaceElement(); @@ -701,21 +702,6 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { this._lineColor = saveColor; this._drawingContext.lineWidth = saveLineWidth; - if(this.application.ninja.currentDocument.model.documentRoot.id !== "UserContent") { - // draw an outline around the body - var stagePt = MathUtils.getPointOnPlane([0,0,1,0]); - var stageMat = this.getPlaneToWorldMatrix([0,0,1], stagePt); - // glmat4.multiply( tMat, stageMat, stageMat); - pt0 = [0, 0, 0]; - pt1 = [0, height, 0]; - delta = [width, 0, 0]; - this.drawGridLines(pt0, pt1, delta, stageMat, 2); - pt0 = [0, 0, 0]; - pt1 = [width, 0, 0]; - delta = [0, height, 0]; - this.drawGridLines(pt0, pt1, delta, stageMat, 2); - } - // draw the lines this.redrawGridLines(); @@ -738,15 +724,11 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { var sourceSpaceMat = this.viewUtils.getLocalToGlobalMatrix( this._sourceSpaceElt ); for (var i = 0; i < nLines; i++) { // transform the points from working plane space to world space - //var t0 = mat.multiply(p0), - // t1 = mat.multiply(p1); var t0 = glmat4.multiplyVec3( mat, p0, [] ), t1 = glmat4.multiplyVec3( mat, p1, [] ); // transform from world space to global screen space if (this._sourceSpaceElt) { -// t0 = this.viewUtils.localToGlobal(t0, this._sourceSpaceElt); -// t1 = this.viewUtils.localToGlobal(t1, this._sourceSpaceElt); t0 = this.viewUtils.localToGlobal2(t0, sourceSpaceMat); t1 = this.viewUtils.localToGlobal2(t1, sourceSpaceMat); } @@ -764,9 +746,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { line.setVisibility(vis); // increment the points to the next position -// p0 = p0.add(d); p0[3] = 1.0; p0 = vecUtils.vecAdd(4, p0, d); p0[3] = 1.0; -// p1 = p1.add(d); p1[3] = 1.0; p1 = vecUtils.vecAdd(4, p1, d); p1[3] = 1.0; } } @@ -819,25 +799,12 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { // draw the lines var line, nLines = this._gridLineArray.length; - if(this.application.ninja.currentDocument.model.documentRoot.id !== "UserContent") { - nLines = this._gridLineArray.length-4; - } for (var i = 0; i < nLines; i++) { line = this._gridLineArray[i]; this.drawIntersectedLine(line, this._drawingContext); } - if(this.application.ninja.currentDocument.model.documentRoot.id !== "UserContent") { - this._lineColor = "red"; - i = nLines; - nLines += 4; - for (; i < nLines; i++) { - line = this._gridLineArray[i]; - this.drawIntersectedLine(line, this._drawingContext); - } - } - this.popState(); } }, @@ -1213,6 +1180,36 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { } }, + drawStageOutline : { + value: function() { + var context = this.application.ninja.stage.gridContext; + var stage = this.application.ninja.stage; + var stageRoot = this.application.ninja.currentDocument.model.documentRoot; + var bounds3D = this.viewUtils.getElementBoundsInGlobal(stageRoot); + + var l = MathUtils.segSegIntersection2D(bounds3D[0], bounds3D[3], [0, 0, 0], [0, stage.canvas.height, 0], 0.1); + var r = MathUtils.segSegIntersection2D(bounds3D[0], bounds3D[3], [stage.canvas.width, 0, 0], [stage.canvas.width, stage.canvas.height, 0], 0.1); + + var t = MathUtils.segSegIntersection2D(bounds3D[0], bounds3D[1], [0, 0, 0], [stage.canvas.width, 0, 0], 0.1); + var b = MathUtils.segSegIntersection2D(bounds3D[0], bounds3D[1], [0, stage.canvas.height, 0], [stage.canvas.width, stage.canvas.height, 0], 0.1); + context.save(); + context.strokeStyle = "#333"; + context.lineWidth = 0.5; + + context.beginPath(); + + context.moveTo(l[0], l[1]); + context.lineTo(r[0], r[1]); + + context.moveTo(t[0], t[1]); + context.lineTo(b[0], b[1]); + + context.closePath(); + context.stroke(); + context.restore(); + } + }, + draw3DCompass : { value: function() { // set the element to be the viewport object - temporarily diff --git a/js/helper-classes/3D/math-utils.js b/js/helper-classes/3D/math-utils.js index 35ee8112..44e2499d 100755 --- a/js/helper-classes/3D/math-utils.js +++ b/js/helper-classes/3D/math-utils.js @@ -333,7 +333,7 @@ var MathUtilsClass = exports.MathUtilsClass = Object.create(Object.prototype, { //returns the intersection point between the two segments (null if no intersection) segSegIntersection2D: { - value: function (seg0Start, seg0End, seg1Start, seg1End, epsilon) { + value: function (seg0Start, seg0End, seg1Start, seg1End, epsilon, mustLieInSegements) { //check for parallel segments var denom = (seg1End[1] - seg1Start[1]) * (seg0End[0] - seg0Start[0]) - (seg1End[0] - seg1Start[0]) * (seg0End[1] - seg0Start[1]); if (Math.abs(denom) <= epsilon) { @@ -349,7 +349,7 @@ var MathUtilsClass = exports.MathUtilsClass = Object.create(Object.prototype, { paramSeg1 /= denom; //check whether the parameters are both between 0 and 1 - if (Math.abs(paramSeg0) > 1.0 || Math.abs(paramSeg1) > 1.0) { + if (mustLieInSegements && (Math.abs(paramSeg0) > 1.0 || Math.abs(paramSeg1) > 1.0)) { return null; //no intersection unless the the intersection point lies on both segments } diff --git a/js/helper-classes/3D/view-utils.js b/js/helper-classes/3D/view-utils.js index 5a128408..d7f29caa 100755 --- a/js/helper-classes/3D/view-utils.js +++ b/js/helper-classes/3D/view-utils.js @@ -244,6 +244,38 @@ exports.ViewUtils = Montage.create(Component, { } }, + getElementBoundsInGlobal: { + value: function (elt) { + this.pushViewportObj(elt); + var bounds3D = this.getElementViewBounds3D(elt); + var tmpMat = this.getLocalToGlobalMatrix(elt); + + var zoomFactor = 1; + var stage = this.application.ninja.stage; + if (stage._viewport && stage._viewport.style && stage._viewport.style.zoom) { + zoomFactor = Number(stage._viewport.style.zoom); + } + + var sSL = stage._scrollLeft; + var sST = stage._scrollTop; + + for (var j=0; j<4; j++) { + var localPt = bounds3D[j]; + var tmpPt = this.localToGlobal2(localPt, tmpMat); + + if(zoomFactor !== 1) { + tmpPt = vecUtils.vecScale(3, tmpPt, zoomFactor); + + tmpPt[0] += sSL*(zoomFactor - 1); + tmpPt[1] += sST*(zoomFactor - 1); + } + bounds3D[j] = tmpPt; + } + this.popViewportObj(); + return bounds3D; + } + }, + getCenterOfProjection: { value: function() { var cop; -- cgit v1.2.3 From bf6585a8f8a6abc203c210ba337e7ef260cb87d3 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Thu, 21 Jun 2012 15:38:48 -0700 Subject: IKNINJA-1720 - Object in a document erases 3D grid in other document when switching with document tabs. Signed-off-by: Nivesh Rajbhandari --- js/stage/layout.js | 3 +++ 1 file changed, 3 insertions(+) (limited to 'js') diff --git a/js/stage/layout.js b/js/stage/layout.js index 28484b71..99c3a403 100755 --- a/js/stage/layout.js +++ b/js/stage/layout.js @@ -46,6 +46,9 @@ exports.Layout = Montage.create(Component, { return; } + drawUtils._eltArray.length = 0; + drawUtils._planesArray.length = 0; + this._currentDocument = value; if(!value) { -- cgit v1.2.3 From 99d50a7dc1403d1d918a8e4a6f7876c559d5e3a9 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Thu, 21 Jun 2012 17:34:37 -0700 Subject: Reclaim negative padding when moving items back into positive direction. Note that we only do this on elementChange and not elementChanging since it is a potentially slow routine. Signed-off-by: Nivesh Rajbhandari --- js/helper-classes/3D/draw-utils.js | 42 +++++++++++++++++++++++++++++--------- js/stage/stage.reel/stage.js | 4 ++++ 2 files changed, 36 insertions(+), 10 deletions(-) (limited to 'js') diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js index 8ddd0d52..42b759b5 100755 --- a/js/helper-classes/3D/draw-utils.js +++ b/js/helper-classes/3D/draw-utils.js @@ -73,6 +73,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { // Properties that require element planes to be updated _updatePlaneProps : {value: ["matrix", "left", "top", "width", "height"], writable: false }, + _recalculateScrollOffsets : { value: false }, /////////////////////////////////////////////////////////////////////// // Property accessors @@ -117,7 +118,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { }, initializeFromDocument:{ - value:function(adjustScrollOffsets){ + value:function(adjustScrollOffsets, useStageValues){ var i, documentRootChildren = this.application.ninja.currentDocument.model.views.design.getLiveNodeList(true), stage = this.application.ninja.stage, @@ -141,6 +142,11 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { t, plane, elt; + if(useStageValues) { + initL = stage.userPaddingLeft; + initT = stage.userPaddingTop; + this._recalculateScrollOffsets = false; + } for(i=0; i minLeft)) { + this._recalculateScrollOffsets = true; } + if(t < minTop) { minTop = t; + stage.minTopElement = elt; + } else if((elt === stage.minTopElement) && (t > minTop)) { + this._recalculateScrollOffsets = true; } } } } if(adjustStagePadding) { - if(minLeft !== stage.userPaddingLeft) { - stage.userPaddingLeft = minLeft; - changed = true; - } - if(minTop !== stage.userPaddingTop) { - stage.userPaddingTop = minTop; + if(this._recalculateScrollOffsets && !isChanging) { + this.initializeFromDocument(true, true); changed = true; + } else { + if(minLeft !== stage.userPaddingLeft) { + stage.userPaddingLeft = minLeft; + changed = true; + } + if(minTop !== stage.userPaddingTop) { + stage.userPaddingTop = minTop; + changed = true; + } } } diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js index fce73882..3552935d 100755 --- a/js/stage/stage.reel/stage.js +++ b/js/stage/stage.reel/stage.js @@ -279,6 +279,10 @@ exports.Stage = Montage.create(Component, { _userPaddingLeft: { value: 0 }, _userPaddingTop: { value: 0 }, + // keep track of the elements that determine the minimum left and top scrollable amount + minLeftElement: { value: null }, + minTopElement: { value: null }, + userPaddingLeft: { get: function() { return this._userPaddingLeft; }, set: function(value) { -- cgit v1.2.3 From b154a6e287dcc2aec57e49ca569ee8004675eb42 Mon Sep 17 00:00:00 2001 From: Jon Reid Date: Thu, 21 Jun 2012 17:46:46 -0700 Subject: Timeline: Bug fix IKNINJA-1791 Double-clicking to go in a child level and coming back up to Body will collapse its layer and wipe out all the sub property keyframes. --- .../Timeline/TimelinePanel.reel/TimelinePanel.js | 50 ++++++++++++++++++---- 1 file changed, 41 insertions(+), 9 deletions(-) (limited to 'js') diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index c8caf50e..96be66e8 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js @@ -733,11 +733,26 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { if (this._boolCacheArrays) { // ... but only if we're supposed to. if(this.currentDocument) { + var i = 0, + hashLength = this.application.ninja.currentDocument.tlBreadcrumbHash.length, + boolHash = false; + this.application.ninja.currentDocument.tlArrLayers = this.arrLayers; this.application.ninja.currentDocument.tlCurrentSelectedContainer = this.currentDocument.model.domContainer; this.application.ninja.currentDocument.tllayerNumber = this.currentLayerNumber; this.application.ninja.currentDocument.tlCurrentLayerSelected = this.currentLayerSelected; this.application.ninja.currentDocument.tlCurrentLayersSelected = this.currentLayersSelected; + for (i = 0; i < hashLength; i++ ) { + if (this.application.ninja.currentDocument.tlBreadcrumbHash[i].containerUuid === this.currentDocument.model.domContainer.uuid) { + boolHash = true; + } + } + if (boolHash === false) { + var newHash = {}; + newHash.containerUuid = this.currentDocument.model.domContainer.uuid; + newHash.arrLayers = this.arrLayers; + this.application.ninja.currentDocument.tlBreadcrumbHash.push(newHash); + } } this.application.ninja.currentDocument.tlCurrentElementsSelected = this.currentElementsSelected; } @@ -754,6 +769,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { this.application.ninja.currentDocument.tlCurrentLayerSelected = false; this.application.ninja.currentDocument.tlCurrentLayersSelected = false; this.application.ninja.currentDocument.tlCurrentElementsSelected = []; + this.application.ninja.currentDocument.tlBreadcrumbHash = []; } }, @@ -934,20 +950,36 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { } else if (this.application.ninja.currentDocument.setLevel) { // console.log('TimelinePanel.initTimelineForDocument: breadCrumbClick'); // Information stored, but we're moving up or down in the breadcrumb. - // Get the current selection and restore timeline info for its children. - var parentNode = this.currentDocument.model.domContainer, + + var i = 0, + hash = this.application.ninja.currentDocument.tlBreadcrumbHash, + hashLength = hash.length, + boolHashed = false, + parentNode = this.currentDocument.model.domContainer, storedCurrentLayerNumber = this.application.ninja.currentDocument.tllayerNumber; - this.temparrLayers = []; - - for (myIndex = 0; parentNode.children[myIndex]; myIndex++) { - this._openDoc = true; - this.restoreLayer(parentNode.children[myIndex]); - - } + this.temparrLayers = []; + + // It's possible there is something stored in the breadcrumb hash in currentdocument, so check there first. + for (i = 0; i < hashLength; i++ ) { + if (hash[i].containerUuid === this.currentDocument.model.domContainer.uuid) { + this.temparrLayers = hash[i].arrLayers + boolHashed = true; + } + } + + // Possibly nothing was in the hash, so check and if so fall back to old restoreLayer method. + if (boolHashed === false) { + for (myIndex = 0; parentNode.children[myIndex]; myIndex++) { + this._openDoc = true; + this.restoreLayer(parentNode.children[myIndex]); + } + } + // Draw the repetition. this.arrLayers = this.temparrLayers; this.currentLayerNumber = storedCurrentLayerNumber; this.application.ninja.currentDocument.setLevel = false; + this.resetMasterDuration(); } else { // console.log('TimelinePanel.initTimelineForDocument: else fallback'); -- cgit v1.2.3 From fff4cd20a23b95519333daec564f309be7d7d4ec Mon Sep 17 00:00:00 2001 From: Jon Reid Date: Thu, 21 Jun 2012 18:01:39 -0700 Subject: Timeline: Bug fix: When creating a new file, Timeline was disabled. (Injection from fix of IKNINJA-1783) --- .../Timeline/TimelinePanel.reel/TimelinePanel.js | 48 ++++++++++++---------- 1 file changed, 27 insertions(+), 21 deletions(-) (limited to 'js') diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index 96be66e8..0d0be721 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js @@ -117,36 +117,42 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { if (value === this._currentDocument) { return; } - + this._currentDocument = value; + + var boolDoc = false, + boolView = false; + // Should we enable the panel? + // Only if we have both a document and we're in design view. + if (typeof(value) !== "undefined") { + if (value.currentView === "design") { + // We are in design view. + boolView = true; + } + } if (typeof(this._currentDocument) !== "undefined") { // We have a document, or at least we have initialized the panel. - // What view are we in? - if (typeof(value) !== "undefined") { - if (value.currentView === "design") { - // We are in design view, so enable the panel. - this.enablePanel(true); - } - } + boolDoc = true; } - this._currentDocument = value; - - if(!value) { + if(boolDoc === false) { this._boolCacheArrays = false; this.clearTimelinePanel(); this._boolCacheArrays = true; this.enablePanel(false); - } else if(this._currentDocument.currentView === "design") { - this._boolCacheArrays = false; - this.clearTimelinePanel(); - this._boolCacheArrays = true; - - // Rebind the document events for the new document context - this._bindDocumentEvents(); - - // Initialize the timeline for the document. - this.initTimelineForDocument(); + } else { + if(boolView === true) { + this._boolCacheArrays = false; + this.clearTimelinePanel(); + this._boolCacheArrays = true; + + // Rebind the document events for the new document context + this._bindDocumentEvents(); + + // Initialize the timeline for the document. + this.initTimelineForDocument(); + this.enablePanel(true); + } } } }, -- cgit v1.2.3 From 82638621ed793fcb37438798363dba151efd9cd2 Mon Sep 17 00:00:00 2001 From: Jon Reid Date: Thu, 21 Jun 2012 23:27:15 -0700 Subject: Timeline: Breadcrumb hash in currentDocument will now update as changes are made to the DOM. --- js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | 1 + 1 file changed, 1 insertion(+) (limited to 'js') diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index 0d0be721..29d19c4f 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js @@ -750,6 +750,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { this.application.ninja.currentDocument.tlCurrentLayersSelected = this.currentLayersSelected; for (i = 0; i < hashLength; i++ ) { if (this.application.ninja.currentDocument.tlBreadcrumbHash[i].containerUuid === this.currentDocument.model.domContainer.uuid) { + this.application.ninja.currentDocument.tlBreadcrumbHash[i].arrLayers = this.arrLayers; boolHash = true; } } -- cgit v1.2.3 From 330a954e92dfc95fae6ae5cf10dd5998f346b304 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Fri, 22 Jun 2012 10:59:17 -0700 Subject: Have to guard against cases when stage lines are parallel to the canvas and the line intersection routine returns null. Signed-off-by: Nivesh Rajbhandari --- js/helper-classes/3D/draw-utils.js | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'js') diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js index c31424eb..168d550d 100755 --- a/js/helper-classes/3D/draw-utils.js +++ b/js/helper-classes/3D/draw-utils.js @@ -1188,10 +1188,15 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { var bounds3D = this.viewUtils.getElementBoundsInGlobal(stageRoot); var l = MathUtils.segSegIntersection2D(bounds3D[0], bounds3D[3], [0, 0, 0], [0, stage.canvas.height, 0], 0.1); + if(!l) return; var r = MathUtils.segSegIntersection2D(bounds3D[0], bounds3D[3], [stage.canvas.width, 0, 0], [stage.canvas.width, stage.canvas.height, 0], 0.1); + if(!r) return; var t = MathUtils.segSegIntersection2D(bounds3D[0], bounds3D[1], [0, 0, 0], [stage.canvas.width, 0, 0], 0.1); + if(!t) return; var b = MathUtils.segSegIntersection2D(bounds3D[0], bounds3D[1], [0, stage.canvas.height, 0], [stage.canvas.width, stage.canvas.height, 0], 0.1); + if(!b) return; + context.save(); context.strokeStyle = "#333"; context.lineWidth = 0.5; -- cgit v1.2.3 From cd7ba9648312a3f55fae9c33285be1d9540e13f9 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Fri, 22 Jun 2012 11:15:46 -0700 Subject: Display "(0, 0)" where the origin is. Signed-off-by: Nivesh Rajbhandari --- js/helper-classes/3D/draw-utils.js | 2 ++ 1 file changed, 2 insertions(+) (limited to 'js') diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js index 168d550d..bd47ffc3 100755 --- a/js/helper-classes/3D/draw-utils.js +++ b/js/helper-classes/3D/draw-utils.js @@ -1211,6 +1211,8 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { context.closePath(); context.stroke(); + + context.fillText("(0, 0)", bounds3D[0][0] + 4, bounds3D[0][1] - 6); context.restore(); } }, -- cgit v1.2.3 From 7563c059270d08395f52d9349bbe4d9aa9d9b99f Mon Sep 17 00:00:00 2001 From: Jonathan Duran Date: Fri, 22 Jun 2012 11:22:47 -0700 Subject: Timeline fix - remove unneeded binding Signed-off-by: Jonathan Duran --- js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | 6 ------ 1 file changed, 6 deletions(-) (limited to 'js') diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index 1c023fdb..53a3b299 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js @@ -869,12 +869,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { this.checkable_lock.addEventListener("click",this.handleLockLayerClick.bind(this),false); this.checkable_visible.addEventListener("click",this.handleLayerVisibleClick.bind(this),false); - // Bind some bindings - Object.defineBinding(this, "currentSelectedContainer", { - boundObject:this.application.ninja, - boundObjectPropertyPath:"currentSelectedContainer", - oneway:true - }); this.addPropertyChangeListener("currentDocument.model.domContainer", this); // Start the panel out in disabled mode by default -- cgit v1.2.3 From 6df664320d6acc489ca0f0f6d99f58d5851a0890 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Fri, 22 Jun 2012 14:15:09 -0700 Subject: fixed a small startup issue with the RDGE library. --- js/helper-classes/RDGE/rdge-compiled.js | 12 ++++++------ js/helper-classes/RDGE/src/core/script/runtime.js | 6 +++++- js/io/system/ninjalibrary.json | 2 +- 3 files changed, 12 insertions(+), 8 deletions(-) (limited to 'js') diff --git a/js/helper-classes/RDGE/rdge-compiled.js b/js/helper-classes/RDGE/rdge-compiled.js index 0bbcb05b..53a99c35 100755 --- a/js/helper-classes/RDGE/rdge-compiled.js +++ b/js/helper-classes/RDGE/rdge-compiled.js @@ -248,13 +248,13 @@ RDGE.SceneGraph.prototype.insertAbove=function(a,b){RDGE.verifyTransformNode(a); RDGE.SceneGraph.prototype._TraverseDFHelper=function(a,b,c){if("undefined"!=b.children){var d=[];for(d.push({node:b,parent:null});0 --- js/controllers/elements/body-controller.js | 20 +++++++++++++++++-- js/document/mediators/template.js | 9 +++++++++ js/document/views/design.js | 7 +++++++ js/helper-classes/3D/draw-utils.js | 32 +++++++++++++++++++++++++++++- 4 files changed, 65 insertions(+), 3 deletions(-) (limited to 'js') diff --git a/js/controllers/elements/body-controller.js b/js/controllers/elements/body-controller.js index 0ca6c417..604b22d0 100755 --- a/js/controllers/elements/body-controller.js +++ b/js/controllers/elements/body-controller.js @@ -19,6 +19,14 @@ exports.BodyController = Montage.create(ElementController, { el.elementModel.props3D.matrix3d = mat; el.elementModel.props3D.perspectiveDist = dist; + if(this.application.ninja.currentDocument.model.views.design._template) { + if(!MathUtils.isIdentityMatrix(mat)) { + el.parentNode.style.backgroundColor = "transparent"; + } else { + el.parentNode.style.removeProperty("background-color"); + } + } + this.application.ninja.stage.updatedStage = true; if(update3DModel) { @@ -32,7 +40,11 @@ exports.BodyController = Montage.create(ElementController, { switch(p) { case "background" : case "background-color": - return this.application.ninja.colorController.getColorObjFromCss(this.application.ninja.stylesController.getElementStyle(el, "background-color")); + if(this.application.ninja.currentDocument.model.views.design._template) { + return this.application.ninja.colorController.getColorObjFromCss(this.application.ninja.stylesController.getElementStyle(el.parentNode, "background-color")); + } else { + return this.application.ninja.colorController.getColorObjFromCss(this.application.ninja.stylesController.getElementStyle(el, "background-color")); + } case "border": return 0; case "height": @@ -51,7 +63,11 @@ exports.BodyController = Montage.create(ElementController, { switch(p) { case "background": case "background-color": - this.application.ninja.stylesController.setElementStyle(el, "background-color", value); + if(this.application.ninja.currentDocument.model.views.design._template) { + this.application.ninja.stylesController.setElementStyle(el.parentNode, "background-color", value); + } else { + this.application.ninja.stylesController.setElementStyle(el, "background-color", value); + } break; case "overflow": case "width": diff --git a/js/document/mediators/template.js b/js/document/mediators/template.js index c5b46c3a..f43b1a2c 100755 --- a/js/document/mediators/template.js +++ b/js/document/mediators/template.js @@ -158,6 +158,15 @@ exports.TemplateDocumentMediator = Montage.create(Component, { ninjaContentTagDoc.removeAttribute('style'); ninjaContentTagDoc.removeAttribute('data-ninja-style'); } + // TODO - clean up into single method + ninjaContentTagMem = template.document.getElementsByTagName('ninja-viewport')[0], ninjaContentTagDoc = template.file.content.document.getElementsByTagName('ninja-viewport')[0]; + if (ninjaContentTagMem && ninjaContentTagMem.getAttribute('data-ninja-style') !== null) { + ninjaContentTagDoc.setAttribute('style', ninjaContentTagMem.getAttribute('data-ninja-style')); + ninjaContentTagDoc.removeAttribute('data-ninja-style'); + } else if (ninjaContentTagMem && ninjaContentTagMem.getAttribute('data-ninja-style') === null) { + ninjaContentTagDoc.removeAttribute('style'); + ninjaContentTagDoc.removeAttribute('data-ninja-style'); + } } else { if (template.body && template.body.getAttribute('data-ninja-style') !== null) { template.file.content.document.body.setAttribute('style', template.body.getAttribute('data-ninja-style')); diff --git a/js/document/views/design.js b/js/document/views/design.js index 44c61617..d5c5c6c4 100755 --- a/js/document/views/design.js +++ b/js/document/views/design.js @@ -281,6 +281,7 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { this.document.body.removeChild(this.document.getElementsByTagName('ninjaloadinghack')[0]); //Getting style and link tags in document var htags = this.document.getElementsByTagName('html'), + bannerWrapper, userStyles, stags = this.document.getElementsByTagName('style'), ltags = this.document.getElementsByTagName('link'), i, orgNodes, @@ -326,6 +327,7 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { //TODO: Verify appropiate location for this operation if (this._template && this._template.type === 'banner') { this.documentRoot = this.document.body.getElementsByTagName('ninja-content')[0]; + bannerWrapper = this.documentRoot.parentNode; } else { this.documentRoot = this.document.body; } @@ -348,6 +350,11 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { if(userStyles = this.documentRoot.getAttribute('style')) { this.documentRoot.setAttribute('data-ninja-style', userStyles); } + } + if(bannerWrapper) { + if(userStyles = bannerWrapper.getAttribute('style')) { + bannerWrapper.setAttribute('data-ninja-style', userStyles); + } } //Making callback if specified if (this._callback) this._callback(); diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js index bd47ffc3..87151964 100755 --- a/js/helper-classes/3D/draw-utils.js +++ b/js/helper-classes/3D/draw-utils.js @@ -1185,8 +1185,38 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { var context = this.application.ninja.stage.gridContext; var stage = this.application.ninja.stage; var stageRoot = this.application.ninja.currentDocument.model.documentRoot; - var bounds3D = this.viewUtils.getElementBoundsInGlobal(stageRoot); + // draw an outline around the template body if stage has any transforms + if(stage.currentDocument.model.views.design._template && !MathUtils.isIdentityMatrix(this.viewUtils.getMatrixFromElement(stageRoot))) { + var saveContext = this.getDrawingSurfaceElement(); + this.setDrawingSurfaceElement(this.application.ninja.stage.gridCanvas); + + var stagePt = MathUtils.getPointOnPlane([0,0,1,0]); + var stageMat = this.getPlaneToWorldMatrix([0,0,1], stagePt); + var width = this.snapManager.getStageWidth(), + height = this.snapManager.getStageHeight(), + pt0 = [0, 0, 0], + pt1 = [0, height, 0], + delta = [width, 0, 0]; + + this._gridLineArray.length = 0; + this.drawGridLines(pt0, pt1, delta, stageMat, 2); + + pt0 = [0, 0, 0]; + pt1 = [width, 0, 0]; + delta = [0, height, 0]; + this.drawGridLines(pt0, pt1, delta, stageMat, 2); + + this._lineColor = "red"; + for (var i = 0; i < 4; i++) { + this.drawIntersectedLine(this._gridLineArray[i], this._drawingContext); + } + + this.setDrawingSurfaceElement(saveContext); + } + + // draw reference lines across origin + var bounds3D = this.viewUtils.getElementBoundsInGlobal(stageRoot); var l = MathUtils.segSegIntersection2D(bounds3D[0], bounds3D[3], [0, 0, 0], [0, stage.canvas.height, 0], 0.1); if(!l) return; var r = MathUtils.segSegIntersection2D(bounds3D[0], bounds3D[3], [stage.canvas.width, 0, 0], [stage.canvas.width, stage.canvas.height, 0], 0.1); -- cgit v1.2.3 From 77ae7eac9c90ce4362a369bd4169607ee610c18d Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Fri, 22 Jun 2012 22:45:38 -0700 Subject: Fixing our textfield component to support binding. Fix for IKNINJA-1394 Signed-off-by: Valerio Virgillito --- js/components/textfield.reel/textfield.js | 23 +++------------------- .../properties.reel/sections/custom.reel/custom.js | 6 +++--- 2 files changed, 6 insertions(+), 23 deletions(-) (limited to 'js') diff --git a/js/components/textfield.reel/textfield.js b/js/components/textfield.reel/textfield.js index 5e22fcc7..e16dd786 100755 --- a/js/components/textfield.reel/textfield.js +++ b/js/components/textfield.reel/textfield.js @@ -27,6 +27,7 @@ exports.TextField = Montage.create(Component, { }, set: function(value) { this._value = value; + this._valueSyncedWithInputField = false; this.needsDraw = true; } }, @@ -41,7 +42,7 @@ exports.TextField = Montage.create(Component, { handleBlur: { value: function(event) { - this._value = this.element.value; + this.value = this.element.value; this._valueSyncedWithInputField = true; var e = document.createEvent("CustomEvent"); @@ -51,27 +52,10 @@ exports.TextField = Montage.create(Component, { this.dispatchEvent(e); } }, - /* - handleChange: - { - value:function(event) - { - this._value = this.element.value; - this._valueSyncedWithInputField = true; - - var e = document.createEvent("CustomEvent"); - e.initEvent("change", true, true); - e.type = "change"; - e.value = this._value; - this.dispatchEvent(e); - } - }, - */ draw: { value: function() { - if(!this._valueSyncedWithInputField) - { + if(!this._valueSyncedWithInputField) { this.element.value = this._value; this._valueSyncedWithInputField = true; } @@ -80,7 +64,6 @@ exports.TextField = Montage.create(Component, { prepareForDraw: { value: function() { - //this.element.addEventListener("change", this, false); this.element.addEventListener("blur", this, false); this.element.addEventListener("keyup", this, false); } diff --git a/js/panels/properties.reel/sections/custom.reel/custom.js b/js/panels/properties.reel/sections/custom.reel/custom.js index 08434b01..9c31cf45 100755 --- a/js/panels/properties.reel/sections/custom.reel/custom.js +++ b/js/panels/properties.reel/sections/custom.reel/custom.js @@ -18,7 +18,6 @@ var Hottext = require("js/components/hottextunit.reel").HotTextUnit; var HT = require("js/components/hottext.reel").HotText; var Dropdown = require("js/components/combobox.reel").Combobox; var TextField = require("js/components/textfield.reel").TextField; -var FileInput = require("js/components/ui/file-input.reel").FileInput; var LabelCheckbox = require("js/components/ui/label-checkbox.reel").LabelCheckbox; var ColorChip = require("js/components/ui/color-chip.reel").ColorChip; var Button = require("montage/ui/button.reel").Button; @@ -322,8 +321,9 @@ exports.CustomSection = Montage.create(Component, { //Bind object value to controls list so it can be manipulated Object.defineBinding(this.controls, aField.id, { - boundObject: obj, - boundObjectPropertyPath: "value" + boundObject: obj, + boundObjectPropertyPath: "value", + oneway: false }); return obj; -- cgit v1.2.3 From 31278a8f3839a637f2e3bbe3541989f118e6a578 Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Sat, 23 Jun 2012 19:23:58 -0700 Subject: Adding soft reset Adding a soft reset to the HTML file we create, this eliminates the margin/padding added to the page by browsers, and better illustrates what the user sees in Ninja. --- js/io/templates/files/html.txt | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'js') diff --git a/js/io/templates/files/html.txt b/js/io/templates/files/html.txt index 3449ae39..33d50c49 100755 --- a/js/io/templates/files/html.txt +++ b/js/io/templates/files/html.txt @@ -10,6 +10,12 @@ -- cgit v1.2.3 From baa9d992a1fc3eb99b53838d898970d7b2be2c65 Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Sat, 23 Jun 2012 20:21:27 -0700 Subject: Support for browser escaped file paths (CSS) This fixes an issue with files located in folder with names/paths that the browser escapes, hence, caused a bug with the path passed to the cloud simulator and files not to be found. This does not require testing to merge. The fix is simple, addresses folder paths with spaces and such characters in which CSS files consumed by the HTML we open in design view. --- js/document/helpers/url-parser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js') diff --git a/js/document/helpers/url-parser.js b/js/document/helpers/url-parser.js index 5e71d148..7bded27d 100755 --- a/js/document/helpers/url-parser.js +++ b/js/document/helpers/url-parser.js @@ -53,7 +53,7 @@ exports.UrlParser = Montage.create(Component, { //Getting file URI (not URL since we must load through I/O API) var css = {}, file; css.cssUrl = href.split(this.application.ninja.coreIoApi.rootUrl)[1]; - css.fileUri = this.application.ninja.coreIoApi.cloudData.root + css.cssUrl; + css.fileUri = this.application.ninja.coreIoApi.cloudData.root + unescape(css.cssUrl); //Loading data from CSS file file = this.application.ninja.coreIoApi.readFile({uri: css.fileUri}); //Checking for file to be writable on disk -- cgit v1.2.3 From 21edfc9a02df0ab4360d5eb41f9ef036500c681b Mon Sep 17 00:00:00 2001 From: Jonathan Duran Date: Mon, 25 Jun 2012 08:12:21 -0700 Subject: Timeline Fix - reopen subpro