required sections for components

master
Theunis J. Botha 2021-09-24 07:36:30 +02:00
parent c7cc11e7a1
commit aa683c05eb
20 changed files with 280 additions and 64 deletions

1
dist/index.html vendored
View File

@ -30,6 +30,7 @@
window.addEventListener("load", function(){
let canvas = new R3.Canvas();
let image = new R3.Image();
let touch = new R3.Touch();
let slider = new R3.Entity.Slider(
{
canvas : null

148
dist/r3.js vendored
View File

@ -1,6 +1,6 @@
class R3 {
static version = '3.0.73';
static compileDate = '2021 Sep 24 - 07:04:55 am';
static version = '3.0.74';
static compileDate = '2021 Sep 24 - 07:23:19 am';
}
class Runtime {
@ -1857,7 +1857,14 @@ class SystemRuntime extends System {
*/
static OnGetRuntime(object) {
if (object instanceof R3.Component.DOM) {
/**
* DOM and Input Components are typically managed through
* the DOM.
*/
if (
object instanceof R3.Component.DOM ||
object instanceof R3.Component.Input
) {
if (SystemRuntime.CurrentProject === null) {
return new R3.Runtime.DOM.Document();
} else {
@ -1865,7 +1872,7 @@ class SystemRuntime extends System {
}
}
if (object instanceof R3.Image) {
if (object instanceof R3.Component.Graphics.Image) {
if (SystemRuntime.CurrentProject === null) {
return new R3.Runtime.Image.WebImage();
} else {
@ -2442,16 +2449,17 @@ Event.RESTART = 0x21;
Event.SLIDER_ENTITY_INITIALIZED = 0x22;
Event.START = 0x23;
Event.TOUCH_CANCEL = 0x24;
Event.TOUCH_END = 0x25;
Event.TOUCH_MOVE = 0x26;
Event.TOUCH_START = 0x27;
Event.UPDATE_FROM_INSTANCE_AFTER = 0x28;
Event.UPDATE_FROM_INSTANCE_BEFORE = 0x29;
Event.UPDATE_INSTANCE_AFTER = 0x2a;
Event.UPDATE_INSTANCE_BEFORE = 0x2b;
Event.UPDATE_INSTANCE_PROPERTY = 0x2c;
Event.UPDATE_PROPERTY_FROM_INSTANCE = 0x2d;
Event.MAX_EVENTS = 0x2e;
Event.TOUCH_COMPONENT_INITIALIZED = 0x25;
Event.TOUCH_END = 0x26;
Event.TOUCH_MOVE = 0x27;
Event.TOUCH_START = 0x28;
Event.UPDATE_FROM_INSTANCE_AFTER = 0x29;
Event.UPDATE_FROM_INSTANCE_BEFORE = 0x2a;
Event.UPDATE_INSTANCE_AFTER = 0x2b;
Event.UPDATE_INSTANCE_BEFORE = 0x2c;
Event.UPDATE_INSTANCE_PROPERTY = 0x2d;
Event.UPDATE_PROPERTY_FROM_INSTANCE = 0x2e;
Event.MAX_EVENTS = 0x2f;
Event.GetEventName = function(eventId) {
@ -2492,15 +2500,16 @@ Event.GetEventName = function(eventId) {
case 0x22 : return 'slider_entity_initialized';
case 0x23 : return 'start';
case 0x24 : return 'touch_cancel';
case 0x25 : return 'touch_end';
case 0x26 : return 'touch_move';
case 0x27 : return 'touch_start';
case 0x28 : return 'update_from_instance_after';
case 0x29 : return 'update_from_instance_before';
case 0x2a : return 'update_instance_after';
case 0x2b : return 'update_instance_before';
case 0x2c : return 'update_instance_property';
case 0x2d : return 'update_property_from_instance';
case 0x25 : return 'touch_component_initialized';
case 0x26 : return 'touch_end';
case 0x27 : return 'touch_move';
case 0x28 : return 'touch_start';
case 0x29 : return 'update_from_instance_after';
case 0x2a : return 'update_from_instance_before';
case 0x2b : return 'update_instance_after';
case 0x2c : return 'update_instance_before';
case 0x2d : return 'update_instance_property';
case 0x2e : return 'update_property_from_instance';
default :
throw new Error('Event type not defined : ' + eventId);
}
@ -2930,6 +2939,8 @@ Entity.MAX_ENTITY = 0x1;
- canvas (Default value null - The Canvas Component to which this entity binds its custom code
components)
- touch (Default value null - The slider component reacts to TOUCH Events, for this a touch
component is required)
- images (Default value [] - The Image Components which will be used to slide from one image to the
next)
@ -2945,8 +2956,9 @@ Entity.MAX_ENTITY = 0x1;
<no static methods>
images=[R3.Image] - We need a list of at least one image which to slide
canvas=R3.Canvas - We need a canvas to attach our Input events
images=[R3.Image] - We need a list of at least one Image which to slide
canvas=R3.Canvas - We need a Canvas to attach our Input events
touch=R3.Touch - We need a Touch Component to respond to TOUCH Events
**/
@ -3028,6 +3040,12 @@ class EntitySlider extends Entity {
if (typeof options.canvas === 'undefined') {
options.canvas = null;
}
/**
* touch - The slider component reacts to TOUCH Events, for this a touch component is required
*/
if (typeof options.touch === 'undefined') {
options.touch = null;
}
/**
* images - The Image Components which will be used to slide from one image to the next
*/
@ -3040,7 +3058,7 @@ class EntitySlider extends Entity {
}
/**
* images - We need a list of at least one image which to slide
* images - We need a list of at least one Image which to slide
*/
options.required.images = [R3.Image];
this.imagesBackup = options.images;
@ -3075,7 +3093,7 @@ class EntitySlider extends Entity {
}
}
) /**
* canvas - We need a canvas to attach our Input events
* canvas - We need a Canvas to attach our Input events
*/
options.required.canvas = R3.Canvas;
this.canvasBackup = options.canvas;
@ -3109,6 +3127,41 @@ class EntitySlider extends Entity {
return this.canvasBackup;
}
}
) /**
* touch - We need a Touch Component to respond to TOUCH Events
*/
options.required.touch = R3.Touch;
this.touchBackup = options.touch;
Object.defineProperty(
this,
'touch',
{
configurable : true,
enumerable : true,
set: function(x) {
Event.Emit(
Event.ENTITY_PROPERTY_UPDATE,
{
entity : this,
property : 'touch',
value : x
}
);
this.touchBackup = x;
Event.Emit(
Event.ENTITY_PROPERTY_UPDATED,
{
entity : this,
property : 'touch',
value : x
}
);
return x;
},
get : function() {
return this.touchBackup;
}
}
)
this.underConstruction = true;
@ -5999,7 +6052,7 @@ class ComponentInput extends Component {
Properties:
<no properties>
- canvas (Default value null - A Touch Component requires a Canvas component to bind to.)
Static Properties:
@ -6056,6 +6109,13 @@ class ComponentTouch extends ComponentInput {
super(options);
/**
* canvas - A Touch Component requires a Canvas component to bind to.
*/
if (typeof options.canvas === 'undefined') {
options.canvas = null;
}
Object.assign(this, options);
if (options.callDepth === 0) {
@ -6074,6 +6134,8 @@ class ComponentTouch extends ComponentInput {
super.initialize();
Event.Emit(Event.TOUCH_COMPONENT_INITIALIZED, this);
if (this.initializeDepth === this.maxDepth) {
if (this instanceof R3.Component) {
@ -6099,6 +6161,21 @@ class ComponentTouch extends ComponentInput {
this.emit(Event.UPDATE_INSTANCE_BEFORE, this);
if (property === 'canvas') {
this.instance.canvas = this.canvas;
this.emit(
Event.UPDATE_INSTANCE_PROPERTY,
{
component : this,
property : 'canvas',
instanceProperty : 'canvas'
}
);
if (property !== 'all') {
return;
}
}
this.emit(Event.UPDATE_INSTANCE_AFTER, this);
}
@ -6112,6 +6189,21 @@ class ComponentTouch extends ComponentInput {
this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this);
if (property === 'canvas' || property === 'all') {
this.canvas = this.instance.canvas;
this.emit(
Event.UPDATE_PROPERTY_FROM_INSTANCE,
{
component : this,
property : 'canvas',
instanceProperty : 'canvas'
}
);
if (property !== 'all') {
return;
}
}
this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this);
}

View File

@ -1,6 +1,6 @@
{
"name": "r3",
"version" : "3.0.73",
"version" : "3.0.74",
"description": "",
"private": true,
"dependencies": {

View File

@ -138,6 +138,9 @@ const ComponentDOM = require('.././r3-component-d-o-m.js');
style='border:1px solid #00bb00;'
CUSTOM_OPTIONS_END
CUSTOM_REQUIRED_COMPONENTS_START
CUSTOM_REQUIRED_COMPONENTS_END
TEMPLATE_STATIC_OPTIONS_START
TEMPLATE_STATIC_OPTIONS_END

View File

@ -112,6 +112,9 @@ const Component = require('.././r3-component.js');
CUSTOM_OPTIONS_START
CUSTOM_OPTIONS_END
CUSTOM_REQUIRED_COMPONENTS_START
CUSTOM_REQUIRED_COMPONENTS_END
TEMPLATE_STATIC_OPTIONS_START
TEMPLATE_STATIC_OPTIONS_END

View File

@ -114,6 +114,9 @@ const Component = require('.././r3-component.js');
instance=null - Holds the current instance of this object as determined (built) by the runtime object.
CUSTOM_OPTIONS_END
CUSTOM_REQUIRED_COMPONENTS_START
CUSTOM_REQUIRED_COMPONENTS_END
TEMPLATE_STATIC_OPTIONS_START
TEMPLATE_STATIC_OPTIONS_END

View File

@ -112,6 +112,9 @@ const Component = require('.././r3-component.js');
CUSTOM_OPTIONS_START
CUSTOM_OPTIONS_END
CUSTOM_REQUIRED_COMPONENTS_START
CUSTOM_REQUIRED_COMPONENTS_END
TEMPLATE_STATIC_OPTIONS_START
TEMPLATE_STATIC_OPTIONS_END

View File

@ -157,6 +157,9 @@ const ComponentGraphics = require('.././r3-component-graphics.js');
orientation='square' - The orientation of the image, one of 'square', 'landscape', 'portrait'
CUSTOM_OPTIONS_END
CUSTOM_REQUIRED_COMPONENTS_START
CUSTOM_REQUIRED_COMPONENTS_END
TEMPLATE_STATIC_OPTIONS_START
TEMPLATE_STATIC_OPTIONS_END

View File

@ -112,6 +112,9 @@ const Component = require('.././r3-component.js');
CUSTOM_OPTIONS_START
CUSTOM_OPTIONS_END
CUSTOM_REQUIRED_COMPONENTS_START
CUSTOM_REQUIRED_COMPONENTS_END
TEMPLATE_STATIC_OPTIONS_START
TEMPLATE_STATIC_OPTIONS_END

View File

@ -130,6 +130,9 @@ const ComponentGraphics = require('.././r3-component-graphics.js');
CUSTOM_OPTIONS_START
CUSTOM_OPTIONS_END
CUSTOM_REQUIRED_COMPONENTS_START
CUSTOM_REQUIRED_COMPONENTS_END
TEMPLATE_STATIC_OPTIONS_START
TEMPLATE_STATIC_OPTIONS_END

View File

@ -130,6 +130,9 @@ const ComponentGraphics = require('.././r3-component-graphics.js');
CUSTOM_OPTIONS_START
CUSTOM_OPTIONS_END
CUSTOM_REQUIRED_COMPONENTS_START
CUSTOM_REQUIRED_COMPONENTS_END
TEMPLATE_STATIC_OPTIONS_START
TEMPLATE_STATIC_OPTIONS_END

View File

@ -130,6 +130,9 @@ const ComponentGraphics = require('.././r3-component-graphics.js');
CUSTOM_OPTIONS_START
CUSTOM_OPTIONS_END
CUSTOM_REQUIRED_COMPONENTS_START
CUSTOM_REQUIRED_COMPONENTS_END
TEMPLATE_STATIC_OPTIONS_START
TEMPLATE_STATIC_OPTIONS_END

View File

@ -105,7 +105,7 @@ const ComponentInput = require('.././r3-component-input.js');
Properties:
<no properties>
- canvas (Default value null - A Touch Component requires a Canvas component to bind to.)
Static Properties:
@ -128,8 +128,12 @@ const ComponentInput = require('.././r3-component-input.js');
TEMPLATE_OPTIONS_END
CUSTOM_OPTIONS_START
canvas=null - A Touch Component requires a Canvas component to bind to.
CUSTOM_OPTIONS_END
CUSTOM_REQUIRED_COMPONENTS_START
CUSTOM_REQUIRED_COMPONENTS_END
TEMPLATE_STATIC_OPTIONS_START
TEMPLATE_STATIC_OPTIONS_END
@ -213,6 +217,12 @@ class ComponentTouch extends ComponentInput {
super(options);
//GENERATED_OPTIONS_INIT_START
/**
* canvas - A Touch Component requires a Canvas component to bind to.
*/
if (typeof options.canvas === 'undefined') {
options.canvas = null;
}
//GENERATED_OPTIONS_INIT_END
//CUSTOM_OPTIONS_INIT_START
@ -247,6 +257,7 @@ class ComponentTouch extends ComponentInput {
//GENERATED_INITIALIZE_METHOD_END
//CUSTOM_INITIALIZE_METHOD_START
Event.Emit(Event.TOUCH_COMPONENT_INITIALIZED, this);
//CUSTOM_INITIALIZE_METHOD_END
//GENERATED_INITIALIZE_METHOD_AFTER_START
@ -278,6 +289,20 @@ class ComponentTouch extends ComponentInput {
this.emit(Event.UPDATE_INSTANCE_BEFORE, this);
//GENERATED_UPDATE_INSTANCE_OPTIONS_START
if (property === 'canvas') {
this.instance.canvas = this.canvas;
this.emit(
Event.UPDATE_INSTANCE_PROPERTY,
{
component : this,
property : 'canvas',
instanceProperty : 'canvas'
}
);
if (property !== 'all') {
return;
}
}
//GENERATED_UPDATE_INSTANCE_OPTIONS_END
//GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_START
@ -305,6 +330,20 @@ class ComponentTouch extends ComponentInput {
this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this);
//GENERATED_UPDATE_FROM_INSTANCE_OPTIONS_START
if (property === 'canvas' || property === 'all') {
this.canvas = this.instance.canvas;
this.emit(
Event.UPDATE_PROPERTY_FROM_INSTANCE,
{
component : this,
property : 'canvas',
instanceProperty : 'canvas'
}
);
if (property !== 'all') {
return;
}
}
//GENERATED_UPDATE_FROM_INSTANCE_OPTIONS_END
//GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_START

View File

@ -89,6 +89,8 @@ const Entity = require('.././r3-entity.js');
- canvas (Default value null - The Canvas Component to which this entity binds its custom code
components)
- touch (Default value null - The slider component reacts to TOUCH Events, for this a touch
component is required)
- images (Default value [] - The Image Components which will be used to slide from one image to the
next)
@ -118,9 +120,16 @@ const Entity = require('.././r3-entity.js');
CUSTOM_OPTIONS_START
canvas=null - The Canvas Component to which this entity binds its custom code components
touch=null - The slider component reacts to TOUCH Events, for this a touch component is required
images=[] - The Image Components which will be used to slide from one image to the next
CUSTOM_OPTIONS_END
CUSTOM_REQUIRED_COMPONENTS_START
images=[R3.Image] - We need a list of at least one Image which to slide
canvas=R3.Canvas - We need a Canvas to attach our Input events
touch=R3.Touch - We need a Touch Component to respond to TOUCH Events
CUSTOM_REQUIRED_COMPONENTS_END
TEMPLATE_STATIC_OPTIONS_START
TEMPLATE_STATIC_OPTIONS_END
@ -137,11 +146,6 @@ const Entity = require('.././r3-entity.js');
CUSTOM_METHODS_START
CUSTOM_METHODS_END
CUSTOM_REQUIRED_COMPONENTS_START
images=[R3.Image] - We need a list of at least one image which to slide
canvas=R3.Canvas - We need a canvas to attach our Input events
CUSTOM_REQUIRED_COMPONENTS_END
TEMPLATE_STATIC_METHODS_START
TEMPLATE_STATIC_METHODS_END
@ -239,6 +243,12 @@ class EntitySlider extends Entity {
if (typeof options.canvas === 'undefined') {
options.canvas = null;
}
/**
* touch - The slider component reacts to TOUCH Events, for this a touch component is required
*/
if (typeof options.touch === 'undefined') {
options.touch = null;
}
/**
* images - The Image Components which will be used to slide from one image to the next
*/
@ -253,7 +263,7 @@ class EntitySlider extends Entity {
//GENERATED_REQUIRED_COMPONENTS_START
/**
* images - We need a list of at least one image which to slide
* images - We need a list of at least one Image which to slide
*/
options.required.images = [R3.Image];
this.imagesBackup = options.images;
@ -288,7 +298,7 @@ class EntitySlider extends Entity {
}
}
) /**
* canvas - We need a canvas to attach our Input events
* canvas - We need a Canvas to attach our Input events
*/
options.required.canvas = R3.Canvas;
this.canvasBackup = options.canvas;
@ -322,6 +332,41 @@ class EntitySlider extends Entity {
return this.canvasBackup;
}
}
) /**
* touch - We need a Touch Component to respond to TOUCH Events
*/
options.required.touch = R3.Touch;
this.touchBackup = options.touch;
Object.defineProperty(
this,
'touch',
{
configurable : true,
enumerable : true,
set: function(x) {
Event.Emit(
Event.ENTITY_PROPERTY_UPDATE,
{
entity : this,
property : 'touch',
value : x
}
);
this.touchBackup = x;
Event.Emit(
Event.ENTITY_PROPERTY_UPDATED,
{
entity : this,
property : 'touch',
value : x
}
);
return x;
},
get : function() {
return this.touchBackup;
}
}
)
//GENERATED_REQUIRED_COMPONENTS_END

View File

@ -381,16 +381,17 @@ Event.RESTART = 0x21;
Event.SLIDER_ENTITY_INITIALIZED = 0x22;
Event.START = 0x23;
Event.TOUCH_CANCEL = 0x24;
Event.TOUCH_END = 0x25;
Event.TOUCH_MOVE = 0x26;
Event.TOUCH_START = 0x27;
Event.UPDATE_FROM_INSTANCE_AFTER = 0x28;
Event.UPDATE_FROM_INSTANCE_BEFORE = 0x29;
Event.UPDATE_INSTANCE_AFTER = 0x2a;
Event.UPDATE_INSTANCE_BEFORE = 0x2b;
Event.UPDATE_INSTANCE_PROPERTY = 0x2c;
Event.UPDATE_PROPERTY_FROM_INSTANCE = 0x2d;
Event.MAX_EVENTS = 0x2e;
Event.TOUCH_COMPONENT_INITIALIZED = 0x25;
Event.TOUCH_END = 0x26;
Event.TOUCH_MOVE = 0x27;
Event.TOUCH_START = 0x28;
Event.UPDATE_FROM_INSTANCE_AFTER = 0x29;
Event.UPDATE_FROM_INSTANCE_BEFORE = 0x2a;
Event.UPDATE_INSTANCE_AFTER = 0x2b;
Event.UPDATE_INSTANCE_BEFORE = 0x2c;
Event.UPDATE_INSTANCE_PROPERTY = 0x2d;
Event.UPDATE_PROPERTY_FROM_INSTANCE = 0x2e;
Event.MAX_EVENTS = 0x2f;
Event.GetEventName = function(eventId) {
@ -431,15 +432,16 @@ Event.GetEventName = function(eventId) {
case 0x22 : return 'slider_entity_initialized';
case 0x23 : return 'start';
case 0x24 : return 'touch_cancel';
case 0x25 : return 'touch_end';
case 0x26 : return 'touch_move';
case 0x27 : return 'touch_start';
case 0x28 : return 'update_from_instance_after';
case 0x29 : return 'update_from_instance_before';
case 0x2a : return 'update_instance_after';
case 0x2b : return 'update_instance_before';
case 0x2c : return 'update_instance_property';
case 0x2d : return 'update_property_from_instance';
case 0x25 : return 'touch_component_initialized';
case 0x26 : return 'touch_end';
case 0x27 : return 'touch_move';
case 0x28 : return 'touch_start';
case 0x29 : return 'update_from_instance_after';
case 0x2a : return 'update_from_instance_before';
case 0x2b : return 'update_instance_after';
case 0x2c : return 'update_instance_before';
case 0x2d : return 'update_instance_property';
case 0x2e : return 'update_property_from_instance';
default :
throw new Error('Event type not defined : ' + eventId);
}

View File

@ -1,6 +1,6 @@
class R3 {
static version = '3.0.73';
static compileDate = '2021 Sep 24 - 07:04:55 am';
static version = '3.0.74';
static compileDate = '2021 Sep 24 - 07:23:19 am';
}
//GENERATED_IMPORTS_START

View File

@ -231,7 +231,14 @@ class SystemRuntime extends System {
//GENERATED_STATIC_ON_GET_RUNTIME_METHOD_END
//CUSTOM_STATIC_ON_GET_RUNTIME_METHOD_START
if (object instanceof R3.Component.DOM) {
/**
* DOM and Input Components are typically managed through
* the DOM.
*/
if (
object instanceof R3.Component.DOM ||
object instanceof R3.Component.Input
) {
if (SystemRuntime.CurrentProject === null) {
return new R3.Runtime.DOM.Document();
} else {
@ -239,7 +246,7 @@ class SystemRuntime extends System {
}
}
if (object instanceof R3.Image) {
if (object instanceof R3.Component.Graphics.Image) {
if (SystemRuntime.CurrentProject === null) {
return new R3.Runtime.Image.WebImage();
} else {

View File

@ -17,6 +17,9 @@ const EXTEND_CLASS = require('INCLUDE_PATH/EXTEND_CLASS_FILE_NAME');
CUSTOM_OPTIONS_START
CUSTOM_OPTIONS_END
CUSTOM_REQUIRED_COMPONENTS_START
CUSTOM_REQUIRED_COMPONENTS_END
TEMPLATE_STATIC_OPTIONS_START
TEMPLATE_STATIC_OPTIONS_END

View File

@ -21,6 +21,9 @@ const EXTEND_CLASS = require('INCLUDE_PATH/EXTEND_CLASS_FILE_NAME');
CUSTOM_OPTIONS_START
CUSTOM_OPTIONS_END
CUSTOM_REQUIRED_COMPONENTS_START
CUSTOM_REQUIRED_COMPONENTS_END
TEMPLATE_STATIC_OPTIONS_START
TEMPLATE_STATIC_OPTIONS_END
@ -37,9 +40,6 @@ const EXTEND_CLASS = require('INCLUDE_PATH/EXTEND_CLASS_FILE_NAME');
CUSTOM_METHODS_START
CUSTOM_METHODS_END
CUSTOM_REQUIRED_COMPONENTS_START
CUSTOM_REQUIRED_COMPONENTS_END
TEMPLATE_STATIC_METHODS_START
TEMPLATE_STATIC_METHODS_END

View File

@ -1 +1 @@
3.0.73
3.0.74