diff options
-rw-r--r-- | assets/canvas-runtime.js | 32 | ||||
-rwxr-xr-x | assets/shaders/linearGradient.vert.glsl | 5 | ||||
-rw-r--r-- | assets/shaders/radialGradient.vert.glsl | 4 | ||||
-rwxr-xr-x | js/controllers/document-controller.js | 2 | ||||
-rwxr-xr-x | js/document/document-html.js | 5 | ||||
-rwxr-xr-x | js/document/html-document.js | 4 | ||||
-rwxr-xr-x | js/document/models/html.js | 5 | ||||
-rwxr-xr-x | js/helper-classes/3D/snap-manager.js | 146 | ||||
-rwxr-xr-x | js/helper-classes/3D/view-utils.js | 13 | ||||
-rwxr-xr-x | js/lib/geom/circle.js | 124 | ||||
-rwxr-xr-x | js/lib/geom/rectangle.js | 190 | ||||
-rw-r--r-- | js/lib/geom/shape-primitive.js | 27 | ||||
-rwxr-xr-x | js/lib/rdge/materials/linear-gradient-material.js | 36 | ||||
-rwxr-xr-x | js/lib/rdge/materials/material.js | 4 | ||||
-rwxr-xr-x | js/lib/rdge/materials/radial-gradient-material.js | 70 | ||||
-rwxr-xr-x | js/ninja.reel/ninja.js | 2 | ||||
-rwxr-xr-x | js/panels/properties.reel/properties.js | 32 | ||||
-rwxr-xr-x | js/panels/properties.reel/sections/custom.reel/custom.js | 2 | ||||
-rwxr-xr-x | js/stage/stage.reel/stage.js | 27 |
19 files changed, 415 insertions, 315 deletions
diff --git a/assets/canvas-runtime.js b/assets/canvas-runtime.js index 9bf22313..af860b95 100644 --- a/assets/canvas-runtime.js +++ b/assets/canvas-runtime.js | |||
@@ -906,11 +906,12 @@ NinjaCvsRt.RuntimeRectangle = Object.create(NinjaCvsRt.RuntimeGeomObj, { | |||
906 | inset = Math.ceil( lw ) - 0.5; | 906 | inset = Math.ceil( lw ) - 0.5; |
907 | 907 | ||
908 | if(this._fillColor.gradientMode) { | 908 | if(this._fillColor.gradientMode) { |
909 | if(this._fillColor.gradientMode === "radial") { | 909 | if(this._fillColor.gradientMode === "radial") { |
910 | gradient = ctx.createRadialGradient(w/2, h/2, 0, w/2, h/2, Math.max(w, h)/2); | 910 | var ww = w - 2*lw, hh = h - 2*lw; |
911 | } else { | 911 | gradient = ctx.createRadialGradient(w/2, h/2, 0, w/2, h/2, Math.max(ww, hh)/2); |
912 | gradient = ctx.createLinearGradient(inset/2, h/2, w-inset, h/2); | 912 | } else { |
913 | } | 913 | gradient = ctx.createLinearGradient(inset, h/2, w-inset, h/2); |
914 | } | ||
914 | colors = this._fillColor.color; | 915 | colors = this._fillColor.color; |
915 | 916 | ||
916 | len = colors.length; | 917 | len = colors.length; |
@@ -940,11 +941,10 @@ NinjaCvsRt.RuntimeRectangle = Object.create(NinjaCvsRt.RuntimeGeomObj, { | |||
940 | inset = Math.ceil( 0.5*lw ) - 0.5; | 941 | inset = Math.ceil( 0.5*lw ) - 0.5; |
941 | 942 | ||
942 | if(this._strokeColor.gradientMode) { | 943 | if(this._strokeColor.gradientMode) { |
943 | if(this._strokeColor.gradientMode === "radial") { | 944 | if(this._strokeColor.gradientMode === "radial") |
944 | gradient = ctx.createRadialGradient(w/2, h/2, Math.min(h, w)/2-inset, w/2, h/2, Math.max(h, w)/2); | 945 | gradient = ctx.createRadialGradient(w/2, h/2, 0, w/2, h/2, Math.max(h, w)/2); |
945 | } else { | 946 | else |
946 | gradient = ctx.createLinearGradient(0, h/2, w, h/2); | 947 | gradient = ctx.createLinearGradient(0, h/2, w, h/2); |
947 | } | ||
948 | colors = this._strokeColor.color; | 948 | colors = this._strokeColor.color; |
949 | 949 | ||
950 | len = colors.length; | 950 | len = colors.length; |
@@ -1144,9 +1144,9 @@ NinjaCvsRt.RuntimeOval = Object.create(NinjaCvsRt.RuntimeGeomObj, { | |||
1144 | if(this._fillColor.gradientMode) { | 1144 | if(this._fillColor.gradientMode) { |
1145 | if(this._fillColor.gradientMode === "radial") { | 1145 | if(this._fillColor.gradientMode === "radial") { |
1146 | gradient = ctx.createRadialGradient(xCtr, yCtr, 0, | 1146 | gradient = ctx.createRadialGradient(xCtr, yCtr, 0, |
1147 | xCtr, yCtr, Math.max(this._width, this._height)/2); | 1147 | xCtr, yCtr, Math.max(this._width, this._height)/2 - lineWidth); |
1148 | } else { | 1148 | } else { |
1149 | gradient = ctx.createLinearGradient(lineWidth/2, this._height/2, this._width-lineWidth, this._height/2); | 1149 | gradient = ctx.createLinearGradient(lineWidth, this._height/2, this._width-lineWidth, this._height/2); |
1150 | } | 1150 | } |
1151 | colors = this._fillColor.color; | 1151 | colors = this._fillColor.color; |
1152 | 1152 | ||
@@ -1222,7 +1222,7 @@ NinjaCvsRt.RuntimeOval = Object.create(NinjaCvsRt.RuntimeGeomObj, { | |||
1222 | if (this._strokeColor) { | 1222 | if (this._strokeColor) { |
1223 | if(this._strokeColor.gradientMode) { | 1223 | if(this._strokeColor.gradientMode) { |
1224 | if(this._strokeColor.gradientMode === "radial") { | 1224 | if(this._strokeColor.gradientMode === "radial") { |
1225 | gradient = ctx.createRadialGradient(xCtr, yCtr, Math.min(xScale, yScale), | 1225 | gradient = ctx.createRadialGradient(xCtr, yCtr, 0, |
1226 | xCtr, yCtr, 0.5*Math.max(this._height, this._width)); | 1226 | xCtr, yCtr, 0.5*Math.max(this._height, this._width)); |
1227 | } else { | 1227 | } else { |
1228 | gradient = ctx.createLinearGradient(0, this._height/2, this._width, this._height/2); | 1228 | gradient = ctx.createLinearGradient(0, this._height/2, this._width, this._height/2); |
@@ -1484,6 +1484,8 @@ NinjaCvsRt.RuntimeRadialGradientMaterial = Object.create(NinjaCvsRt.RuntimeMater | |||
1484 | _colorStop3: { value: 0.6, writable: true }, | 1484 | _colorStop3: { value: 0.6, writable: true }, |
1485 | _colorStop4: { value: 1.0, writable: true }, | 1485 | _colorStop4: { value: 1.0, writable: true }, |
1486 | 1486 | ||
1487 | _textureTransform: { value: [1,0,0, 0,1,0, 0,0,1], writable: true }, | ||
1488 | |||
1487 | init: { | 1489 | init: { |
1488 | value: function(world) { | 1490 | value: function(world) { |
1489 | var material = this._materialNode; | 1491 | var material = this._materialNode; |
@@ -1505,6 +1507,8 @@ NinjaCvsRt.RuntimeRadialGradientMaterial = Object.create(NinjaCvsRt.RuntimeMater | |||
1505 | this._shader["default"].u_colorStop3.set( [this._colorStop3] ); | 1507 | this._shader["default"].u_colorStop3.set( [this._colorStop3] ); |
1506 | this._shader["default"].u_colorStop4.set( [this._colorStop4] ); | 1508 | this._shader["default"].u_colorStop4.set( [this._colorStop4] ); |
1507 | 1509 | ||
1510 | this._shader["default"].u_texTransform.set( this._textureTransform ); | ||
1511 | |||
1508 | if (this._angle !== undefined) | 1512 | if (this._angle !== undefined) |
1509 | this._shader["default"].u_cos_sin_angle.set([Math.cos(this._angle), Math.sin(this._angle)]); | 1513 | this._shader["default"].u_cos_sin_angle.set([Math.cos(this._angle), Math.sin(this._angle)]); |
1510 | } | 1514 | } |
@@ -1524,6 +1528,8 @@ NinjaCvsRt.RuntimeRadialGradientMaterial = Object.create(NinjaCvsRt.RuntimeMater | |||
1524 | this._colorStop3 = jObj.colorStop3; | 1528 | this._colorStop3 = jObj.colorStop3; |
1525 | this._colorStop4 = jObj.colorStop4; | 1529 | this._colorStop4 = jObj.colorStop4; |
1526 | 1530 | ||
1531 | this._textureTransform = jObj.textureTransform; | ||
1532 | |||
1527 | if (this._angle !== undefined) | 1533 | if (this._angle !== undefined) |
1528 | this._angle = jObj.angle; | 1534 | this._angle = jObj.angle; |
1529 | } | 1535 | } |
diff --git a/assets/shaders/linearGradient.vert.glsl b/assets/shaders/linearGradient.vert.glsl index aac9cbee..f0800812 100755 --- a/assets/shaders/linearGradient.vert.glsl +++ b/assets/shaders/linearGradient.vert.glsl | |||
@@ -37,6 +37,7 @@ uniform float u_colorStop3; | |||
37 | uniform float u_colorStop4; | 37 | uniform float u_colorStop4; |
38 | uniform vec2 u_cos_sin_angle; | 38 | uniform vec2 u_cos_sin_angle; |
39 | //uniform int u_colorCount; // currently using 4 | 39 | //uniform int u_colorCount; // currently using 4 |
40 | uniform mat3 u_texTransform; | ||
40 | 41 | ||
41 | varying vec2 v_uv; | 42 | varying vec2 v_uv; |
42 | 43 | ||
@@ -44,5 +45,7 @@ varying vec2 v_uv; | |||
44 | void main(void) | 45 | void main(void) |
45 | { | 46 | { |
46 | gl_Position = u_projMatrix * u_mvMatrix * vec4(vert,1.0) ; | 47 | gl_Position = u_projMatrix * u_mvMatrix * vec4(vert,1.0) ; |
47 | v_uv = texcoord; | 48 | //v_uv = texcoord; |
49 | vec3 tmp = u_texTransform * vec3( texcoord, 1.0); | ||
50 | v_uv = tmp.xy; | ||
48 | } | 51 | } |
diff --git a/assets/shaders/radialGradient.vert.glsl b/assets/shaders/radialGradient.vert.glsl index c3e1b50a..7994ac12 100644 --- a/assets/shaders/radialGradient.vert.glsl +++ b/assets/shaders/radialGradient.vert.glsl | |||
@@ -18,11 +18,13 @@ attribute vec2 texcoord; | |||
18 | // matrix uniforms | 18 | // matrix uniforms |
19 | uniform mat4 u_mvMatrix; | 19 | uniform mat4 u_mvMatrix; |
20 | uniform mat4 u_projMatrix; | 20 | uniform mat4 u_projMatrix; |
21 | uniform mat3 u_texTransform; | ||
21 | 22 | ||
22 | varying vec2 v_uv; | 23 | varying vec2 v_uv; |
23 | 24 | ||
24 | void main(void) | 25 | void main(void) |
25 | { | 26 | { |
26 | gl_Position = u_projMatrix * u_mvMatrix * vec4(vert,1.0) ; | 27 | gl_Position = u_projMatrix * u_mvMatrix * vec4(vert,1.0) ; |
27 | v_uv = texcoord; | 28 | vec3 tmp = u_texTransform * vec3( texcoord, 1.0); |
29 | v_uv = tmp.xy; | ||
28 | } \ No newline at end of file | 30 | } \ No newline at end of file |
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index 2eba556e..9ca5ea99 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js | |||
@@ -501,7 +501,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
501 | if(currentDocument) { | 501 | if(currentDocument) { |
502 | if(currentDocument.currentView === "design") { | 502 | if(currentDocument.currentView === "design") { |
503 | currentDocument.serializeDocument(); | 503 | currentDocument.serializeDocument(); |
504 | this.application.ninja.selectionController._selectionContainer = null; | 504 | this.application.ninja._currentSelectedContainer = this.application.ninja.selectionController._selectionContainer = null; |
505 | currentDocument.model.views.design.propertiesPanel.clear(); | 505 | currentDocument.model.views.design.propertiesPanel.clear(); |
506 | } | 506 | } |
507 | 507 | ||
diff --git a/js/document/document-html.js b/js/document/document-html.js index d6b4ba95..f92a425c 100755 --- a/js/document/document-html.js +++ b/js/document/document-html.js | |||
@@ -147,9 +147,10 @@ exports.HtmlDocument = Montage.create(Component, { | |||
147 | this.model.userContentTop = this.application.ninja.stage._userContentTop; | 147 | this.model.userContentTop = this.application.ninja.stage._userContentTop; |
148 | 148 | ||
149 | 149 | ||
150 | // Serialize the selection | 150 | // Serialize the selection, the container and grid |
151 | //TODO: Move this property to the design view class | 151 | //TODO: Move this property to the design view class |
152 | this.model.selection = this.application.ninja.selectedElements.slice(0); | 152 | this.model.selection = this.application.ninja.selectedElements.slice(0); |
153 | this.model.selectionContainer = this.application.ninja.currentSelectedContainer; | ||
153 | this.draw3DGrid = this.application.ninja.appModel.show3dGrid; | 154 | this.draw3DGrid = this.application.ninja.appModel.show3dGrid; |
154 | 155 | ||
155 | // Serialize the undo | 156 | // Serialize the undo |
@@ -177,7 +178,7 @@ exports.HtmlDocument = Montage.create(Component, { | |||
177 | 178 | ||
178 | //TODO: Move this property to the design view class | 179 | //TODO: Move this property to the design view class |
179 | this.application.ninja.selectedElements = this.model.selection.slice(0); | 180 | this.application.ninja.selectedElements = this.model.selection.slice(0); |
180 | 181 | // this.application.ninja.currentSelectedContainer = this.model.selectionContainer; | |
181 | this.application.ninja.appModel.show3dGrid = this.draw3DGrid; | 182 | this.application.ninja.appModel.show3dGrid = this.draw3DGrid; |
182 | 183 | ||
183 | // Serialize the undo | 184 | // Serialize the undo |
diff --git a/js/document/html-document.js b/js/document/html-document.js index bcf2b5c2..447d90e3 100755 --- a/js/document/html-document.js +++ b/js/document/html-document.js | |||
@@ -209,8 +209,8 @@ exports.HTMLDocument = Montage.create(TextDocument, { | |||
209 | { | 209 | { |
210 | /* | 210 | /* |
211 | // Use this code to test the runtime version of WebGL | 211 | // Use this code to test the runtime version of WebGL |
212 | var cdm = new NinjaCvsRt.CanvasDataManager(); |