some image handling

master
Theunis J. Botha 2021-09-17 11:56:58 +02:00
parent 42b628419d
commit f952a37b49
9 changed files with 652 additions and 185 deletions

402
dist/r3.js vendored
View File

@ -1,6 +1,6 @@
class R3 {
static version = '2.0.695';
static compileDate = '2021 Sep 17 - 11:29:51 am';
static version = '2.0.708';
static compileDate = '2021 Sep 17 - 11:48:18 am';
}
class Runtime {
@ -278,85 +278,89 @@ class Event {
}
Event.COMPONENT_CREATED = 0x1;
Event.COMPONENT_INITIALIZED = 0x2;
Event.CREATE_INSTANCE_BEFORE = 0x3;
Event.DISPOSE_INSTANCE = 0x4;
Event.DISPOSE_OBJECT = 0x5;
Event.DOM_COMPONENT_INITIALIZED = 0x6;
Event.ENTITY_CREATED = 0x7;
Event.ENTITY_INITIALIZED = 0x8;
Event.GET_RUNTIME = 0x9;
Event.GET_WINDOW_SIZE = 0xa;
Event.GRAPHICS_COMPONENT_INITIALIZED = 0xb;
Event.IMAGE_CREATED = 0xc;
Event.INPUT_COMPONENT_INITIALIZED = 0xd;
Event.INSTANCE_CREATED = 0xe;
Event.INSTANCE_DISPOSED = 0xf;
Event.KEYBOARD_DOWN = 0x10;
Event.KEYBOARD_UP = 0x11;
Event.MOUSE_DOWN = 0x12;
Event.MOUSE_MOVE = 0x13;
Event.MOUSE_UP = 0x14;
Event.MOUSE_WHEEL = 0x15;
Event.OBJECT_CREATED = 0x16;
Event.OBJECT_INITIALIZED = 0x17;
Event.PAUSE = 0x18;
Event.PROJECT_INITIALIZED = 0x19;
Event.RESTART = 0x1a;
Event.START = 0x1b;
Event.TOUCH_CANCEL = 0x1c;
Event.TOUCH_END = 0x1d;
Event.TOUCH_MOVE = 0x1e;
Event.TOUCH_START = 0x1f;
Event.UPDATE_FROM_INSTANCE_AFTER = 0x20;
Event.UPDATE_FROM_INSTANCE_BEFORE = 0x21;
Event.UPDATE_INSTANCE_AFTER = 0x22;
Event.UPDATE_INSTANCE_BEFORE = 0x23;
Event.UPDATE_INSTANCE_PROPERTY = 0x24;
Event.UPDATE_PROPERTY_FROM_INSTANCE = 0x25;
Event.MAX_EVENTS = 0x26;
Event.BEFORE_RENDER = 0x1;
Event.COMPONENT_CREATED = 0x2;
Event.COMPONENT_INITIALIZED = 0x3;
Event.CREATE_INSTANCE_BEFORE = 0x4;
Event.DISPOSE_INSTANCE = 0x5;
Event.DISPOSE_OBJECT = 0x6;
Event.DOM_COMPONENT_INITIALIZED = 0x7;
Event.ENTITY_CREATED = 0x8;
Event.ENTITY_INITIALIZED = 0x9;
Event.GET_RUNTIME = 0xa;
Event.GET_WINDOW_SIZE = 0xb;
Event.GRAPHICS_COMPONENT_INITIALIZED = 0xc;
Event.IMAGE_COMPONENT_INITIALIZED = 0xd;
Event.IMAGE_INITIALIZED = 0xe;
Event.INPUT_COMPONENT_INITIALIZED = 0xf;
Event.INSTANCE_CREATED = 0x10;
Event.INSTANCE_DISPOSED = 0x11;
Event.KEYBOARD_DOWN = 0x12;
Event.KEYBOARD_UP = 0x13;
Event.MOUSE_DOWN = 0x14;
Event.MOUSE_MOVE = 0x15;
Event.MOUSE_UP = 0x16;
Event.MOUSE_WHEEL = 0x17;
Event.OBJECT_CREATED = 0x18;
Event.OBJECT_INITIALIZED = 0x19;
Event.PAUSE = 0x1a;
Event.PROJECT_INITIALIZED = 0x1b;
Event.RESTART = 0x1c;
Event.START = 0x1d;
Event.TOUCH_CANCEL = 0x1e;
Event.TOUCH_END = 0x1f;
Event.TOUCH_MOVE = 0x20;
Event.TOUCH_START = 0x21;
Event.UPDATE_FROM_INSTANCE_AFTER = 0x22;
Event.UPDATE_FROM_INSTANCE_BEFORE = 0x23;
Event.UPDATE_INSTANCE_AFTER = 0x24;
Event.UPDATE_INSTANCE_BEFORE = 0x25;
Event.UPDATE_INSTANCE_PROPERTY = 0x26;
Event.UPDATE_PROPERTY_FROM_INSTANCE = 0x27;
Event.MAX_EVENTS = 0x28;
Event.GetEventName = function(eventId) {
switch(eventId) {
case 0x1 : return 'component_created';
case 0x2 : return 'component_initialized';
case 0x3 : return 'create_instance_before';
case 0x4 : return 'dispose_instance';
case 0x5 : return 'dispose_object';
case 0x6 : return 'dom_component_initialized';
case 0x7 : return 'entity_created';
case 0x8 : return 'entity_initialized';
case 0x9 : return 'get_runtime';
case 0xa : return 'get_window_size';
case 0xb : return 'graphics_component_initialized';
case 0xc : return 'image_created';
case 0xd : return 'input_component_initialized';
case 0xe : return 'instance_created';
case 0xf : return 'instance_disposed';
case 0x10 : return 'keyboard_down';
case 0x11 : return 'keyboard_up';
case 0x12 : return 'mouse_down';
case 0x13 : return 'mouse_move';
case 0x14 : return 'mouse_up';
case 0x15 : return 'mouse_wheel';
case 0x16 : return 'object_created';
case 0x17 : return 'object_initialized';
case 0x18 : return 'pause';
case 0x19 : return 'project_initialized';
case 0x1a : return 'restart';
case 0x1b : return 'start';
case 0x1c : return 'touch_cancel';
case 0x1d : return 'touch_end';
case 0x1e : return 'touch_move';
case 0x1f : return 'touch_start';
case 0x20 : return 'update_from_instance_after';
case 0x21 : return 'update_from_instance_before';
case 0x22 : return 'update_instance_after';
case 0x23 : return 'update_instance_before';
case 0x24 : return 'update_instance_property';
case 0x25 : return 'update_property_from_instance';
case 0x1 : return 'before_render';
case 0x2 : return 'component_created';
case 0x3 : return 'component_initialized';
case 0x4 : return 'create_instance_before';
case 0x5 : return 'dispose_instance';
case 0x6 : return 'dispose_object';
case 0x7 : return 'dom_component_initialized';
case 0x8 : return 'entity_created';
case 0x9 : return 'entity_initialized';
case 0xa : return 'get_runtime';
case 0xb : return 'get_window_size';
case 0xc : return 'graphics_component_initialized';
case 0xd : return 'image_component_initialized';
case 0xe : return 'image_initialized';
case 0xf : return 'input_component_initialized';
case 0x10 : return 'instance_created';
case 0x11 : return 'instance_disposed';
case 0x12 : return 'keyboard_down';
case 0x13 : return 'keyboard_up';
case 0x14 : return 'mouse_down';
case 0x15 : return 'mouse_move';
case 0x16 : return 'mouse_up';
case 0x17 : return 'mouse_wheel';
case 0x18 : return 'object_created';
case 0x19 : return 'object_initialized';
case 0x1a : return 'pause';
case 0x1b : return 'project_initialized';
case 0x1c : return 'restart';
case 0x1d : return 'start';
case 0x1e : return 'touch_cancel';
case 0x1f : return 'touch_end';
case 0x20 : return 'touch_move';
case 0x21 : return 'touch_start';
case 0x22 : return 'update_from_instance_after';
case 0x23 : return 'update_from_instance_before';
case 0x24 : return 'update_instance_after';
case 0x25 : return 'update_instance_before';
case 0x26 : return 'update_instance_property';
case 0x27 : return 'update_property_from_instance';
default :
throw new Error('Event type not defined : ' + eventId);
}
@ -3140,9 +3144,9 @@ class SystemStorage extends System {
*/
static Start(options) {
SystemStorage.Subscriptions['IMAGE_CREATED'] = Event.Subscribe(
Event.IMAGE_CREATED,
SystemStorage.OnImageCreated
SystemStorage.Subscriptions['IMAGE_COMPONENT_INITIALIZED'] = Event.Subscribe(
Event.IMAGE_COMPONENT_INITIALIZED,
SystemStorage.OnImageComponentInitialized
);
SystemStorage.Started = true;
@ -3158,8 +3162,8 @@ class SystemStorage extends System {
*/
static Stop(options) {
SystemStorage.Subscriptions['IMAGE_CREATED'].remove();
delete SystemStorage.Subscriptions['IMAGE_CREATED'];
SystemStorage.Subscriptions['IMAGE_COMPONENT_INITIALIZED'].remove();
delete SystemStorage.Subscriptions['IMAGE_COMPONENT_INITIALIZED'];
SystemStorage.Started = false;
@ -3168,12 +3172,18 @@ class SystemStorage extends System {
}
/**
* OnImageCreated()
* - Listens to events of type Event.IMAGE_CREATED and executes this function.
* OnImageComponentInitialized()
* - Listens to events of type Event.IMAGE_COMPONENT_INITIALIZED and executes this function.
* @param object (The event data passed as argument - typically an R3Object)
* @return null
*/
static OnImageCreated(object) {
static OnImageComponentInitialized(object) {
//GENERATED_STATIC_ON_IMAGE_COMPONENT_INITIALIZED_METHOD_START
//GENERATED_STATIC_ON_IMAGE_COMPONENT_INITIALIZED_METHOD_END
//CUSTOM_STATIC_ON_IMAGE_COMPONENT_INITIALIZED_METHOD_START
//CUSTOM_STATIC_ON_IMAGE_COMPONENT_INITIALIZED_METHOD_END
}
@ -5389,7 +5399,17 @@ class ComponentCanvas extends ComponentDOM {
Properties:
<no properties>
- fileName (Default value Utils.LowerUnderscore(options.name) - Name of the image under which it is
stored)
- extension (Default value '.unknown' - Extension of the file name including the '.' (ex. '.jpg'))
- path (Default value '/' - Path on the server to the file, excluding filename)
- contentType (Default value 'application/octet-stream' - Content type of the file (based on the
extension, ex. 'image/jpeg'))
- size (Default value 0 - Size of the file in bytes)
- width (Default value 0 - Width of the image in pixels)
- height (Default value 0 - height of the image in pixels)
- orientation (Default value 'square' - The orientation of the image, one of 'square', 'landscape',
'portrait')
Static Properties:
@ -5397,7 +5417,8 @@ class ComponentCanvas extends ComponentDOM {
Methods:
<no methods>
- initialize()
Also raises Event.IMAGE_INITIALIZED
Static Methods:
@ -5438,8 +5459,81 @@ class ComponentImage extends ComponentGraphics {
options.instance = null;
}
/**
* fileName - Name of the image under which it is stored
*/
if (typeof options.fileName === 'undefined') {
options.fileName = Utils.LowerUnderscore(options.name);
}
/**
* extension - Extension of the file name including the '.' (ex. '.jpg')
*/
if (typeof options.extension === 'undefined') {
options.extension = '.unknown';
}
/**
* path - Path on the server to the file, excluding filename
*/
if (typeof options.path === 'undefined') {
options.path = '/';
}
/**
* contentType - Content type of the file (based on the extension, ex. 'image/jpeg')
*/
if (typeof options.contentType === 'undefined') {
options.contentType = 'application/octet-stream';
}
/**
* size - Size of the file in bytes
*/
if (typeof options.size === 'undefined') {
options.size = 0;
}
/**
* width - Width of the image in pixels
*/
if (typeof options.width === 'undefined') {
options.width = 0;
}
/**
* height - height of the image in pixels
*/
if (typeof options.height === 'undefined') {
options.height = 0;
}
/**
* orientation - The orientation of the image, one of 'square', 'landscape', 'portrait'
*/
if (typeof options.orientation === 'undefined') {
options.orientation = 'square';
}
if (options.extension.match(/(png)$/i)) {
options.contentType = 'image/png';
}
if (options.extension.match(/(jpg|jpeg)$/i)) {
options.contentType = 'image/jpeg';
}
if (options.extension.match(/(gif)$/i)) {
options.contentType = 'image/gif';
}
Object.assign(this, options);
if (this.width > this.height) {
this.orientation = 'landscape';
}
if (this.width < this.height) {
this.orientation = 'portrait';
}
if (this.width === this.height) {
this.orientation = 'square';
}
if (options.callDepth === 0) {
this.initialize();
} else {
@ -5457,6 +5551,63 @@ class ComponentImage extends ComponentGraphics {
this.emit(Event.UPDATE_INSTANCE_BEFORE, this);
if (property === 'size') {
this.instance.size = this.size;
this.emit(
Event.UPDATE_INSTANCE_PROPERTY,
{
component : this,
property : 'size',
instanceProperty : 'size'
}
);
if (property !== 'all') {
return;
}
}
if (property === 'width') {
this.instance.width = this.width;
this.emit(
Event.UPDATE_INSTANCE_PROPERTY,
{
component : this,
property : 'width',
instanceProperty : 'width'
}
);
if (property !== 'all') {
return;
}
}
if (property === 'height') {
this.instance.height = this.height;
this.emit(
Event.UPDATE_INSTANCE_PROPERTY,
{
component : this,
property : 'height',
instanceProperty : 'height'
}
);
if (property !== 'all') {
return;
}
}
if (property === 'orientation') {
this.instance.orientation = this.orientation;
this.emit(
Event.UPDATE_INSTANCE_PROPERTY,
{
component : this,
property : 'orientation',
instanceProperty : 'orientation'
}
);
if (property !== 'all') {
return;
}
}
this.emit(Event.UPDATE_INSTANCE_AFTER, this);
}
@ -5470,10 +5621,87 @@ class ComponentImage extends ComponentGraphics {
this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this);
if (property === 'size' || property === 'all') {
this.size = this.instance.size;
this.emit(
Event.UPDATE_PROPERTY_FROM_INSTANCE,
{
component : this,
property : 'size',
instanceProperty : 'size'
}
);
if (property !== 'all') {
return;
}
}
if (property === 'width' || property === 'all') {
this.width = this.instance.width;
this.emit(
Event.UPDATE_PROPERTY_FROM_INSTANCE,
{
component : this,
property : 'width',
instanceProperty : 'width'
}
);
if (property !== 'all') {
return;
}
}
if (property === 'height' || property === 'all') {
this.height = this.instance.height;
this.emit(
Event.UPDATE_PROPERTY_FROM_INSTANCE,
{
component : this,
property : 'height',
instanceProperty : 'height'
}
);
if (property !== 'all') {
return;
}
}
if (property === 'orientation' || property === 'all') {
this.orientation = this.instance.orientation;
this.emit(
Event.UPDATE_PROPERTY_FROM_INSTANCE,
{
component : this,
property : 'orientation',
instanceProperty : 'orientation'
}
);
if (property !== 'all') {
return;
}
}
this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this);
}
/**
* initialize()
* - Also raises Event.IMAGE_INITIALIZED
*/
initialize() {
if (this.initialized) {
console.warn('Multiple calls to initialize() - check your callstack');
} else {
delete this.callDepth;
this.initialized = true;
}
Event.Emit(Event.OBJECT_INITIALIZED, this);
Event.Emit(Event.COMPONENT_INITIALIZED, this);
Event.Emit(Event.GRAPHICS_COMPONENT_INITIALIZED, this);
Event.Emit(Event.IMAGE_COMPONENT_INITIALIZED, this);
}
}
/**

View File

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

View File

@ -107,7 +107,17 @@ const ComponentGraphics = require('.././r3-component-graphics.js');
Properties:
<no properties>
- fileName (Default value Utils.LowerUnderscore(options.name) - Name of the image under which it is
stored)
- extension (Default value '.unknown' - Extension of the file name including the '.' (ex. '.jpg'))
- path (Default value '/' - Path on the server to the file, excluding filename)
- contentType (Default value 'application/octet-stream' - Content type of the file (based on the
extension, ex. 'image/jpeg'))
- size (Default value 0 - Size of the file in bytes)
- width (Default value 0 - Width of the image in pixels)
- height (Default value 0 - height of the image in pixels)
- orientation (Default value 'square' - The orientation of the image, one of 'square', 'landscape',
'portrait')
Static Properties:
@ -115,7 +125,8 @@ const ComponentGraphics = require('.././r3-component-graphics.js');
Methods:
<no methods>
- initialize()
Also raises Event.IMAGE_INITIALIZED
Static Methods:
@ -129,6 +140,14 @@ const ComponentGraphics = require('.././r3-component-graphics.js');
TEMPLATE_OPTIONS_END
CUSTOM_OPTIONS_START
fileName=Utils.LowerUnderscore(options.name) - Name of the image under which it is stored
extension='.unknown' - Extension of the file name including the '.' (ex. '.jpg')
path='/' - Path on the server to the file, excluding filename
contentType='application/octet-stream' - Content type of the file (based on the extension, ex. 'image/jpeg')
size=0 - Size of the file in bytes
width=0 - Width of the image in pixels
height=0 - height of the image in pixels
orientation='square' - The orientation of the image, one of 'square', 'landscape', 'portrait'
CUSTOM_OPTIONS_END
TEMPLATE_STATIC_OPTIONS_START
@ -149,6 +168,10 @@ const ComponentGraphics = require('.././r3-component-graphics.js');
TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_END
CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_START
fileName
extension
path
contentType
CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_END
TEMPLATE_METHODS_START
@ -157,6 +180,7 @@ const ComponentGraphics = require('.././r3-component-graphics.js');
TEMPLATE_METHODS_END
CUSTOM_METHODS_START
initialize() - Also raises Event.IMAGE_INITIALIZED
CUSTOM_METHODS_END
TEMPLATE_STATIC_METHODS_START
@ -204,14 +228,88 @@ class ComponentImage extends ComponentGraphics {
//GENERATED_TEMPLATE_OPTIONS_INIT_END
//GENERATED_OPTIONS_INIT_START
/**
* fileName - Name of the image under which it is stored
*/
if (typeof options.fileName === 'undefined') {
options.fileName = Utils.LowerUnderscore(options.name);
}
/**
* extension - Extension of the file name including the '.' (ex. '.jpg')
*/
if (typeof options.extension === 'undefined') {
options.extension = '.unknown';
}
/**
* path - Path on the server to the file, excluding filename
*/
if (typeof options.path === 'undefined') {
options.path = '/';
}
/**
* contentType - Content type of the file (based on the extension, ex. 'image/jpeg')
*/
if (typeof options.contentType === 'undefined') {
options.contentType = 'application/octet-stream';
}
/**
* size - Size of the file in bytes
*/
if (typeof options.size === 'undefined') {
options.size = 0;
}
/**
* width - Width of the image in pixels
*/
if (typeof options.width === 'undefined') {
options.width = 0;
}
/**
* height - height of the image in pixels
*/
if (typeof options.height === 'undefined') {
options.height = 0;
}
/**
* orientation - The orientation of the image, one of 'square', 'landscape', 'portrait'
*/
if (typeof options.orientation === 'undefined') {
options.orientation = 'square';
}
//GENERATED_OPTIONS_INIT_END
//CUSTOM_OPTIONS_INIT_START
if (options.extension.match(/(png)$/i)) {
options.contentType = 'image/png';
}
if (options.extension.match(/(jpg|jpeg)$/i)) {
options.contentType = 'image/jpeg';
}
if (options.extension.match(/(gif)$/i)) {
options.contentType = 'image/gif';
}
//CUSTOM_OPTIONS_INIT_END
Object.assign(this, options);
//CUSTOM_BEFORE_INIT_START
if (this.width > this.height) {
this.orientation = 'landscape';
}
if (this.width < this.height) {
this.orientation = 'portrait';
}
if (this.width === this.height) {
this.orientation = 'square';
}
//CUSTOM_BEFORE_INIT_END
if (options.callDepth === 0) {
@ -238,6 +336,62 @@ class ComponentImage extends ComponentGraphics {
this.emit(Event.UPDATE_INSTANCE_BEFORE, this);
//GENERATED_UPDATE_INSTANCE_OPTIONS_START
if (property === 'size') {
this.instance.size = this.size;
this.emit(
Event.UPDATE_INSTANCE_PROPERTY,
{
component : this,
property : 'size',
instanceProperty : 'size'
}
);
if (property !== 'all') {
return;
}
}
if (property === 'width') {
this.instance.width = this.width;
this.emit(
Event.UPDATE_INSTANCE_PROPERTY,
{
component : this,
property : 'width',
instanceProperty : 'width'
}
);
if (property !== 'all') {
return;
}
}
if (property === 'height') {
this.instance.height = this.height;
this.emit(
Event.UPDATE_INSTANCE_PROPERTY,
{
component : this,
property : 'height',
instanceProperty : 'height'
}
);
if (property !== 'all') {
return;
}
}
if (property === 'orientation') {
this.instance.orientation = this.orientation;
this.emit(
Event.UPDATE_INSTANCE_PROPERTY,
{
component : this,
property : 'orientation',
instanceProperty : 'orientation'
}
);
if (property !== 'all') {
return;
}
}
//GENERATED_UPDATE_INSTANCE_OPTIONS_END
//GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_START
@ -262,6 +416,62 @@ class ComponentImage extends ComponentGraphics {
this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this);
//GENERATED_UPDATE_FROM_INSTANCE_OPTIONS_START
if (property === 'size' || property === 'all') {
this.size = this.instance.size;
this.emit(
Event.UPDATE_PROPERTY_FROM_INSTANCE,
{
component : this,
property : 'size',
instanceProperty : 'size'
}
);
if (property !== 'all') {
return;
}
}
if (property === 'width' || property === 'all') {
this.width = this.instance.width;
this.emit(
Event.UPDATE_PROPERTY_FROM_INSTANCE,
{
component : this,
property : 'width',
instanceProperty : 'width'
}
);
if (property !== 'all') {
return;
}
}
if (property === 'height' || property === 'all') {
this.height = this.instance.height;
this.emit(
Event.UPDATE_PROPERTY_FROM_INSTANCE,
{
component : this,
property : 'height',
instanceProperty : 'height'
}
);
if (property !== 'all') {
return;
}
}
if (property === 'orientation' || property === 'all') {
this.orientation = this.instance.orientation;
this.emit(
Event.UPDATE_PROPERTY_FROM_INSTANCE,
{
component : this,
property : 'orientation',
instanceProperty : 'orientation'
}
);
if (property !== 'all') {
return;
}
}
//GENERATED_UPDATE_FROM_INSTANCE_OPTIONS_END
//GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_START
@ -278,6 +488,30 @@ class ComponentImage extends ComponentGraphics {
//GENERATED_TEMPLATE_METHODS_END
//GENERATED_METHODS_START
/**
* initialize()
* - Also raises Event.IMAGE_INITIALIZED
*/
initialize() {
//GENERATED_INITIALIZE_METHOD_START
if (this.initialized) {
console.warn('Multiple calls to initialize() - check your callstack');
} else {
delete this.callDepth;
this.initialized = true;
}
//GENERATED_INITIALIZE_METHOD_END
//CUSTOM_INITIALIZE_METHOD_START
Event.Emit(Event.OBJECT_INITIALIZED, this);
Event.Emit(Event.COMPONENT_INITIALIZED, this);
Event.Emit(Event.GRAPHICS_COMPONENT_INITIALIZED, this);
Event.Emit(Event.IMAGE_COMPONENT_INITIALIZED, this);
//CUSTOM_INITIALIZE_METHOD_END
}
//GENERATED_METHODS_END
//GENERATED_TEMPLATE_STATIC_METHODS_START

View File

@ -336,85 +336,89 @@ class Event {
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START
//GENERATED_EVENTS_START
Event.COMPONENT_CREATED = 0x1;
Event.COMPONENT_INITIALIZED = 0x2;
Event.CREATE_INSTANCE_BEFORE = 0x3;
Event.DISPOSE_INSTANCE = 0x4;
Event.DISPOSE_OBJECT = 0x5;
Event.DOM_COMPONENT_INITIALIZED = 0x6;
Event.ENTITY_CREATED = 0x7;
Event.ENTITY_INITIALIZED = 0x8;
Event.GET_RUNTIME = 0x9;
Event.GET_WINDOW_SIZE = 0xa;
Event.GRAPHICS_COMPONENT_INITIALIZED = 0xb;
Event.IMAGE_CREATED = 0xc;
Event.INPUT_COMPONENT_INITIALIZED = 0xd;
Event.INSTANCE_CREATED = 0xe;
Event.INSTANCE_DISPOSED = 0xf;
Event.KEYBOARD_DOWN = 0x10;
Event.KEYBOARD_UP = 0x11;
Event.MOUSE_DOWN = 0x12;
Event.MOUSE_MOVE = 0x13;
Event.MOUSE_UP = 0x14;
Event.MOUSE_WHEEL = 0x15;
Event.OBJECT_CREATED = 0x16;
Event.OBJECT_INITIALIZED = 0x17;
Event.PAUSE = 0x18;
Event.PROJECT_INITIALIZED = 0x19;
Event.RESTART = 0x1a;
Event.START = 0x1b;
Event.TOUCH_CANCEL = 0x1c;
Event.TOUCH_END = 0x1d;
Event.TOUCH_MOVE = 0x1e;
Event.TOUCH_START = 0x1f;
Event.UPDATE_FROM_INSTANCE_AFTER = 0x20;
Event.UPDATE_FROM_INSTANCE_BEFORE = 0x21;
Event.UPDATE_INSTANCE_AFTER = 0x22;
Event.UPDATE_INSTANCE_BEFORE = 0x23;
Event.UPDATE_INSTANCE_PROPERTY = 0x24;
Event.UPDATE_PROPERTY_FROM_INSTANCE = 0x25;
Event.MAX_EVENTS = 0x26;
Event.BEFORE_RENDER = 0x1;
Event.COMPONENT_CREATED = 0x2;
Event.COMPONENT_INITIALIZED = 0x3;
Event.CREATE_INSTANCE_BEFORE = 0x4;
Event.DISPOSE_INSTANCE = 0x5;
Event.DISPOSE_OBJECT = 0x6;
Event.DOM_COMPONENT_INITIALIZED = 0x7;
Event.ENTITY_CREATED = 0x8;
Event.ENTITY_INITIALIZED = 0x9;
Event.GET_RUNTIME = 0xa;
Event.GET_WINDOW_SIZE = 0xb;
Event.GRAPHICS_COMPONENT_INITIALIZED = 0xc;
Event.IMAGE_COMPONENT_INITIALIZED = 0xd;
Event.IMAGE_INITIALIZED = 0xe;
Event.INPUT_COMPONENT_INITIALIZED = 0xf;
Event.INSTANCE_CREATED = 0x10;
Event.INSTANCE_DISPOSED = 0x11;
Event.KEYBOARD_DOWN = 0x12;
Event.KEYBOARD_UP = 0x13;
Event.MOUSE_DOWN = 0x14;
Event.MOUSE_MOVE = 0x15;
Event.MOUSE_UP = 0x16;
Event.MOUSE_WHEEL = 0x17;
Event.OBJECT_CREATED = 0x18;
Event.OBJECT_INITIALIZED = 0x19;
Event.PAUSE = 0x1a;
Event.PROJECT_INITIALIZED = 0x1b;
Event.RESTART = 0x1c;
Event.START = 0x1d;
Event.TOUCH_CANCEL = 0x1e;
Event.TOUCH_END = 0x1f;
Event.TOUCH_MOVE = 0x20;
Event.TOUCH_START = 0x21;
Event.UPDATE_FROM_INSTANCE_AFTER = 0x22;
Event.UPDATE_FROM_INSTANCE_BEFORE = 0x23;
Event.UPDATE_INSTANCE_AFTER = 0x24;
Event.UPDATE_INSTANCE_BEFORE = 0x25;
Event.UPDATE_INSTANCE_PROPERTY = 0x26;
Event.UPDATE_PROPERTY_FROM_INSTANCE = 0x27;
Event.MAX_EVENTS = 0x28;
Event.GetEventName = function(eventId) {
switch(eventId) {
case 0x1 : return 'component_created';
case 0x2 : return 'component_initialized';
case 0x3 : return 'create_instance_before';
case 0x4 : return 'dispose_instance';
case 0x5 : return 'dispose_object';
case 0x6 : return 'dom_component_initialized';
case 0x7 : return 'entity_created';
case 0x8 : return 'entity_initialized';
case 0x9 : return 'get_runtime';
case 0xa : return 'get_window_size';
case 0xb : return 'graphics_component_initialized';
case 0xc : return 'image_created';
case 0xd : return 'input_component_initialized';
case 0xe : return 'instance_created';
case 0xf : return 'instance_disposed';
case 0x10 : return 'keyboard_down';
case 0x11 : return 'keyboard_up';
case 0x12 : return 'mouse_down';
case 0x13 : return 'mouse_move';
case 0x14 : return 'mouse_up';
case 0x15 : return 'mouse_wheel';
case 0x16 : return 'object_created';
case 0x17 : return 'object_initialized';
case 0x18 : return 'pause';
case 0x19 : return 'project_initialized';
case 0x1a : return 'restart';
case 0x1b : return 'start';
case 0x1c : return 'touch_cancel';
case 0x1d : return 'touch_end';
case 0x1e : return 'touch_move';
case 0x1f : return 'touch_start';
case 0x20 : return 'update_from_instance_after';
case 0x21 : return 'update_from_instance_before';
case 0x22 : return 'update_instance_after';
case 0x23 : return 'update_instance_before';
case 0x24 : return 'update_instance_property';
case 0x25 : return 'update_property_from_instance';
case 0x1 : return 'before_render';
case 0x2 : return 'component_created';
case 0x3 : return 'component_initialized';
case 0x4 : return 'create_instance_before';
case 0x5 : return 'dispose_instance';
case 0x6 : return 'dispose_object';
case 0x7 : return 'dom_component_initialized';
case 0x8 : return 'entity_created';
case 0x9 : return 'entity_initialized';
case 0xa : return 'get_runtime';
case 0xb : return 'get_window_size';
case 0xc : return 'graphics_component_initialized';
case 0xd : return 'image_component_initialized';
case 0xe : return 'image_initialized';
case 0xf : return 'input_component_initialized';
case 0x10 : return 'instance_created';
case 0x11 : return 'instance_disposed';
case 0x12 : return 'keyboard_down';
case 0x13 : return 'keyboard_up';
case 0x14 : return 'mouse_down';
case 0x15 : return 'mouse_move';
case 0x16 : return 'mouse_up';
case 0x17 : return 'mouse_wheel';
case 0x18 : return 'object_created';
case 0x19 : return 'object_initialized';
case 0x1a : return 'pause';
case 0x1b : return 'project_initialized';
case 0x1c : return 'restart';
case 0x1d : return 'start';
case 0x1e : return 'touch_cancel';
case 0x1f : return 'touch_end';
case 0x20 : return 'touch_move';
case 0x21 : return 'touch_start';
case 0x22 : return 'update_from_instance_after';
case 0x23 : return 'update_from_instance_before';
case 0x24 : return 'update_instance_after';
case 0x25 : return 'update_instance_before';
case 0x26 : return 'update_instance_property';
case 0x27 : return 'update_property_from_instance';
default :
throw new Error('Event type not defined : ' + eventId);
}

View File

@ -1,6 +1,6 @@
class R3 {
static version = '2.0.695';
static compileDate = '2021 Sep 17 - 11:29:51 am';
static version = '2.0.708';
static compileDate = '2021 Sep 17 - 11:48:18 am';
}
//GENERATED_IMPORTS_START

View File

@ -63,7 +63,7 @@ const System = require('.././r3-system.js');
CUSTOM_EVENT_LISTENERS_END
CUSTOM_STATIC_EVENT_LISTENERS_START
Event.IMAGE_CREATED
Event.IMAGE_COMPONENT_INITIALIZED
CUSTOM_STATIC_EVENT_LISTENERS_END
TEMPLATE_METHODS_START
@ -127,9 +127,9 @@ class SystemStorage extends System {
//GENERATED_STATIC_START_METHOD_START
//GENERATED_STATIC_EVENT_LISTENERS_START_START
SystemStorage.Subscriptions['IMAGE_CREATED'] = Event.Subscribe(
Event.IMAGE_CREATED,
SystemStorage.OnImageCreated
SystemStorage.Subscriptions['IMAGE_COMPONENT_INITIALIZED'] = Event.Subscribe(
Event.IMAGE_COMPONENT_INITIALIZED,
SystemStorage.OnImageComponentInitialized
);
//GENERATED_STATIC_EVENT_LISTENERS_START_END
@ -158,8 +158,8 @@ class SystemStorage extends System {
//GENERATED_STATIC_STOP_METHOD_START
//GENERATED_STATIC_EVENT_LISTENERS_STOP_START
SystemStorage.Subscriptions['IMAGE_CREATED'].remove();
delete SystemStorage.Subscriptions['IMAGE_CREATED'];
SystemStorage.Subscriptions['IMAGE_COMPONENT_INITIALIZED'].remove();
delete SystemStorage.Subscriptions['IMAGE_COMPONENT_INITIALIZED'];
//GENERATED_STATIC_EVENT_LISTENERS_STOP_END
@ -187,18 +187,19 @@ class SystemStorage extends System {
//GENERATED_STATIC_EVENT_LISTENER_METHODS_START
/**
* OnImageCreated()
* - Listens to events of type Event.IMAGE_CREATED and executes this function.
* OnImageComponentInitialized()
* - Listens to events of type Event.IMAGE_COMPONENT_INITIALIZED and executes this function.
* @param object (The event data passed as argument - typically an R3Object)
* @return null
*/
static OnImageCreated(object) {
static OnImageComponentInitialized(object) {
//GENERATED_STATIC_ON_IMAGE_CREATED_METHOD_START
//GENERATED_STATIC_ON_IMAGE_CREATED_METHOD_END
//GENERATED_STATIC_ON_IMAGE_COMPONENT_INITIALIZED_METHOD_START
//GENERATED_STATIC_ON_IMAGE_COMPONENT_INITIALIZED_METHOD_END
//CUSTOM_STATIC_ON_IMAGE_CREATED_METHOD_START
//CUSTOM_STATIC_ON_IMAGE_CREATED_METHOD_END
//CUSTOM_STATIC_ON_IMAGE_COMPONENT_INITIALIZED_METHOD_START
object.createInstance();
//CUSTOM_STATIC_ON_IMAGE_COMPONENT_INITIALIZED_METHOD_END
}
//GENERATED_STATIC_EVENT_LISTENER_METHODS_END

View File

@ -4,8 +4,8 @@
Event.UPDATE_PROPERTY_FROM_INSTANCE,
{
component : this,
property : KEY,
instanceProperty : INSTANCE_KEY
property : 'KEY',
instanceProperty : 'INSTANCE_KEY'
}
);
if (property !== 'all') {

View File

@ -4,8 +4,8 @@
Event.UPDATE_INSTANCE_PROPERTY,
{
component : this,
property : KEY,
instanceProperty : INSTANCE_KEY
property : 'KEY',
instanceProperty : 'INSTANCE_KEY'
}
);
if (property !== 'all') {

View File

@ -1 +1 @@
2.0.695
2.0.708