![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
canvas-area
Advanced tools
lightweight html container element as a controller parent for one or more canvas elements. It allows zoom, pan and resize interactions
canvas-area
is a lightweight custom html element as a controller parent for one or more canvas elements.
It allows zoom, pan and resize interactions.
<canvas-area id="ca" width="401" height="301" resizable="both">
<canvas id="c"></canvas>
</canvas-area>
width
: width of element in px
.height
: height of element in px
.resizable
: one of ['none'
, 'horizontal'
, 'vertical'
, 'both'
].cartesian
: true
or false
Multiple canvases are mostly used as layers in practice. It is up to you, how you organize, what to draw on which layer. Often there is a background layer holding static graphics, which does not need to be updated frequently. In contrast to that there might be a dynamic layer holding animated graphics for instance. There also might be an interactivity layer, containing editable geometry.
Separating low frequently updated geometry from high frequently updated geometry by different layers should result in a performance gain.
Please note, when using multiple canvases - and stacking them on top of each other:
position:absolute;
style.z-index: 5;
style.canvas
elements are transparent by default. So avoid giving them background colors.canvas-area
is managing the resize of its canvas
children, but not their redraw
.canvas-area
is managing the view parameters for pan and zoom, but does not apply those values to the canvas
contexes. Do that by yourself while redrawing or using the on('view',...)
handler.Example:
<canvas-area id="ca" width="401" height="301">
<canvas id="c1" style="position:absolute; z-index:1;"></canvas>
<canvas id="c2" style="position:absolute; z-index:2;"></canvas>
</canvas-area>
canvas-area
behaves as a standard html container element with known inherited DOM properties and methods. Additionally it offers properties ...
Property | Type | Value | Default |
---|---|---|---|
width | Number | width of element in px | 300 px |
height | Number | height of element in px | 150 px |
resizable | String | one of ['none' , 'horizontal' , 'vertical' , 'both' ] | 'none' |
cursor | String | simple interface to CSS cursor attribute. | 'auto' |
view | {x,y,scl} | origin location x,y in px and scaling factor scl | {0,0,1} |
cartesian | Boolean | true : y -axis pointing up, false : y -axis pointing down | false |
... methods ...
Method | Arguments | Returns | Comment |
---|---|---|---|
pan({dx,dy}) | dx : delta xdy : delta y | undefined | origin displacement. Modifies view property |
zoom({x,y,scl}) | x : x-centery : y-centerscl : factor | undefined | zoom about point {x,y} by factor scl . Modifies view property |
pntToUsr({x,y}) | point | point | transform argument point (device coordinates) to result point (user coordinates) with respect to view property |
notify(key,value) | key : event typevalue : event data | undefined | notify observers of event type key about event value |
on(key,handler) | key : event typehandler : event handler | this | register handler with event type key . |
... and events, which can be observed via observe
method.
Type | Object | Value |
---|---|---|
'pointer' | {x,y,...} * | User has moved the pointer. |
'drag' | {x,y,...} * | User has moved the pointer with left button down. |
'resize' | {width,height} | User did resize canvas-area element |
'view' | {x,y,scl} | User modified the view property via pan, zoom, ... |
'buttondown' | {x,y,...} * | User has pressed the pointer device's button down. |
'buttonup' | {x,y,...} * | User has released the pointer device's button. |
'pointerenter' | {x,y,...} * | pointer has entered the canvas-area . |
'pointerleave' | {x,y,...} * | pointer has left the canvas-area . |
{x,y,...}
* custom event data object:
Property | Description |
---|---|
x,y | Pointer location in device coordinates. |
dx,dy | Pointer displacement in device coordinates since last pointer event. |
buttons | Device buttons pressed (1 :left, 2 : right, 4 : middle button). |
delta | Mouse wheel delta units. |
Use following link for canvas-area.js
.
https://gitcdn.xyz/cdn/goessner/canvas-area/master/canvas-area.js
Does not work properly with Mobile Device X and Touch Screen Y ?
Can you implement feature X and possibly feature Y ?
canvas-area
serves my personal needs very well as it is.on(key,handler)
added.observe(key,handler)
marked as deprecated. Use on(key,handler)
instead.buttons
to btn
in [drag
,pointer
,buttondown
,buttonup
,pointerenter
,pointerleave
] event.display: block; overflow: hidden;
automatically added as inline style while constructing.canvas-area
is licensed under the MIT License
FAQs
lightweight html container element as a controller parent for one or more canvas elements. It allows zoom, pan and resize interactions
We found that canvas-area demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.