Skip to content

Commit 1a1e0a4

Browse files
authored
Playground: Update flow.module.js - fix zoom
1 parent 37d6f28 commit 1a1e0a4

File tree

1 file changed

+122
-2
lines changed

1 file changed

+122
-2
lines changed

playground/libs/flow.module.js

Lines changed: 122 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ let _id = 0;
2424

2525
class Serializer extends EventTarget {
2626

27+
static get type() {
28+
29+
return 'Serializer';
30+
31+
}
32+
2733
constructor() {
2834

2935
super();
@@ -74,7 +80,7 @@ class Serializer extends EventTarget {
7480

7581
get className() {
7682

77-
return this.constructor.name;
83+
return this.constructor.type || this.constructor.name;
7884

7985
}
8086

@@ -446,6 +452,12 @@ let selected = null;
446452

447453
class Element extends Serializer {
448454

455+
static get type() {
456+
457+
return 'Element';
458+
459+
}
460+
449461
constructor( draggable = false ) {
450462

451463
super();
@@ -1230,6 +1242,12 @@ Element.icons = { unlink: '' };
12301242

12311243
class Input extends Serializer {
12321244

1245+
static get type() {
1246+
1247+
return 'Input';
1248+
1249+
}
1250+
12331251
constructor( dom ) {
12341252

12351253
super();
@@ -1388,6 +1406,12 @@ Input.prototype.isInput = true;
13881406

13891407
class Node extends Serializer {
13901408

1409+
static get type() {
1410+
1411+
return 'Node';
1412+
1413+
}
1414+
13911415
constructor() {
13921416

13931417
super();
@@ -1774,6 +1798,12 @@ Node.prototype.isNode = true;
17741798

17751799
class DraggableElement extends Element {
17761800

1801+
static get type() {
1802+
1803+
return 'DraggableElement';
1804+
1805+
}
1806+
17771807
constructor( draggable = true ) {
17781808

17791809
super( true );
@@ -1803,6 +1833,12 @@ class DraggableElement extends Element {
18031833

18041834
class TitleElement extends DraggableElement {
18051835

1836+
static get type() {
1837+
1838+
return 'TitleElement';
1839+
1840+
}
1841+
18061842
constructor( title, draggable = true ) {
18071843

18081844
super( draggable );
@@ -1954,6 +1990,12 @@ const dropNode = new Node().add( new TitleElement( 'File' ) ).setWidth( 250 );
19541990

19551991
class Canvas extends Serializer {
19561992

1993+
static get type() {
1994+
1995+
return 'Canvas';
1996+
1997+
}
1998+
19571999
constructor() {
19582000

19592001
super();
@@ -2424,7 +2466,10 @@ class Canvas extends Serializer {
24242466

24252467
get useTransform() {
24262468

2427-
return navigator.userAgent.match( /firefox/i ) !== null;
2469+
const userAgent = navigator.userAgent;
2470+
const isSafari = /Safari/.test( userAgent ) && ! /Chrome/.test( userAgent );
2471+
2472+
return ! isSafari;
24282473

24292474
}
24302475

@@ -3643,6 +3688,12 @@ class Search extends Menu {
36433688

36443689
class LabelElement extends Element {
36453690

3691+
static get type() {
3692+
3693+
return 'LabelElement';
3694+
3695+
}
3696+
36463697
constructor( label = '', align = '' ) {
36473698

36483699
super();
@@ -3746,6 +3797,12 @@ class LabelElement extends Element {
37463797

37473798
class ButtonInput extends Input {
37483799

3800+
static get type() {
3801+
3802+
return 'ButtonInput';
3803+
3804+
}
3805+
37493806
constructor( innterText = '' ) {
37503807

37513808
const dom = document.createElement( 'button' );
@@ -3814,6 +3871,12 @@ class ButtonInput extends Input {
38143871

38153872
class ColorInput extends Input {
38163873

3874+
static get type() {
3875+
3876+
return 'ColorInput';
3877+
3878+
}
3879+
38173880
constructor( value = 0x0099ff ) {
38183881

38193882
const dom = document.createElement( 'input' );
@@ -3846,6 +3909,12 @@ class ColorInput extends Input {
38463909

38473910
class NumberInput extends Input {
38483911

3912+
static get type() {
3913+
3914+
return 'NumberInput';
3915+
3916+
}
3917+
38493918
constructor( value = 0, min = - Infinity, max = Infinity, step = .01 ) {
38503919

38513920
const dom = document.createElement( 'input' );
@@ -3953,6 +4022,15 @@ class NumberInput extends Input {
39534022

39544023
}
39554024

4025+
setInterger( bool ) {
4026+
4027+
this.integer = bool;
4028+
this.step = .1;
4029+
4030+
return this.setValue( this.getValue() );
4031+
4032+
}
4033+
39564034
get precision() {
39574035

39584036
if ( this.integer === true ) return 0;
@@ -4025,6 +4103,12 @@ class NumberInput extends Input {
40254103

40264104
class SelectInput extends Input {
40274105

4106+
static get type() {
4107+
4108+
return 'SelectInput';
4109+
4110+
}
4111+
40284112
constructor( options = [], value = null ) {
40294113

40304114
const dom = document.createElement( 'select' );
@@ -4126,6 +4210,12 @@ const getStep = ( min, max ) => {
41264210

41274211
class SliderInput extends Input {
41284212

4213+
static get type() {
4214+
4215+
return 'SliderInput';
4216+
4217+
}
4218+
41294219
constructor( value = 0, min = 0, max = 100 ) {
41304220

41314221
const dom = document.createElement( 'f-subinputs' );
@@ -4262,6 +4352,12 @@ class SliderInput extends Input {
42624352

42634353
class StringInput extends Input {
42644354

4355+
static get type() {
4356+
4357+
return 'StringInput';
4358+
4359+
}
4360+
42654361
constructor( value = '' ) {
42664362

42674363
const dom = document.createElement( 'f-string' );
@@ -4426,6 +4522,12 @@ class StringInput extends Input {
44264522

44274523
class TextInput extends Input {
44284524

4525+
static get type() {
4526+
4527+
return 'TextInput';
4528+
4529+
}
4530+
44294531
constructor( innerText = '' ) {
44304532

44314533
const dom = document.createElement( 'textarea' );
@@ -4467,6 +4569,12 @@ class TextInput extends Input {
44674569

44684570
class ToggleInput extends Input {
44694571

4572+
static get type() {
4573+
4574+
return 'ToggleInput';
4575+
4576+
}
4577+
44704578
constructor( value = false ) {
44714579

44724580
const dom = document.createElement( 'input' );
@@ -4648,6 +4756,12 @@ class TreeViewNode {
46484756

46494757
class TreeViewInput extends Input {
46504758

4759+
static get type() {
4760+
4761+
return 'TreeViewInput';
4762+
4763+
}
4764+
46514765
constructor( options = [] ) {
46524766

46534767
const dom = document.createElement( 'f-treeview' );
@@ -4728,6 +4842,12 @@ const LoaderLib = {};
47284842

47294843
class Loader extends EventTarget {
47304844

4845+
static get type() {
4846+
4847+
return 'Loader';
4848+
4849+
}
4850+
47314851
constructor( parseType = Loader.DEFAULT ) {
47324852

47334853
super();

0 commit comments

Comments
 (0)