浏览代码

✨ Add Shape base class

Pedro Schneider 3 年之前
父节点
当前提交
56007da194
共有 5 个文件被更改,包括 49 次插入5 次删除
  1. 1 0
      build
  2. 1 1
      pandora.min.js
  3. 2 2
      pandora/components/Ellipse.js
  4. 2 2
      pandora/components/Rect.js
  5. 43 0
      pandora/components/Shape.js

+ 1 - 0
build

@@ -16,6 +16,7 @@ cat pandora/components/Component.js >> build.js
 cat pandora/components/Color.js >> build.js
 cat pandora/components/Vector2.js >> build.js
 cat pandora/components/Signal.js >> build.js
+cat pandora/components/Shape.js >> build.js
 cat pandora/components/Rect.js >> build.js
 cat pandora/components/Ellipse.js >> build.js
 

文件差异内容过多而无法显示
+ 1 - 1
pandora.min.js


+ 2 - 2
pandora/components/Ellipse.js

@@ -27,7 +27,7 @@
  * 
  * @class
  */
-class Ellipse extends Component
+class Ellipse extends Shape
 {
     /**
      * Initializes an Ellipse with the given parameters.
@@ -40,7 +40,7 @@ class Ellipse extends Component
     constructor(rx, ry = rx)
     {
         super();
-        
+
         this.rx = rx;
         this.ry = ry;
     }

+ 2 - 2
pandora/components/Rect.js

@@ -27,7 +27,7 @@
  * 
  * @class
  */
-class Rect extends Component
+class Rect extends Shape
 {
     /**
      * Initializes a Rect with the given parameters.
@@ -40,7 +40,7 @@ class Rect extends Component
     constructor(w, h = w)
     {
         super();
-        
+
         this.w = w;
         this.h = h;
     }

+ 43 - 0
pandora/components/Shape.js

@@ -0,0 +1,43 @@
+/************************************************************************
+ * Shape.js
+ ************************************************************************
+ * Copyright (c) 2021 Pedro Tonini Rosenberg Schneider.
+ *
+ * This file is part of Pandora.
+ *
+ * Pandora is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Pandora is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *     
+ * You should have received a copy of the GNU General Public License     
+ * along with Pandora.  If not, see <https://www.gnu.org/licenses/>.
+ *************************************************************************/
+
+/**
+ * This {@code Shape} class represents the base class all Shape components inherit from.
+ * 
+ * ! This is an empty class the serves only to be inherited from to organize the hierarchy.
+ * ! This class should not bet used by the user.
+ * 
+ * @author Pedro Schneider
+ * 
+ * @class
+ */
+class Shape extends Component
+{
+    /**
+     * Creates an empty Shape Component.
+     * 
+     * @constructor
+     */
+    constructor()
+    {
+        super();
+    }
+}